Code example for LinkedBlockingQueue

Methods: poll

0
	} 
 
	public String readLine(long timeout) throws TimeoutException {
		String line = null;
		try { 
			line = queue.poll(timeout, TimeUnit.MILLISECONDS);
		} catch (InterruptedException e) {
			if (D) Log.e(TAG, "" + System.currentTimeMillis() + " readLine() interrupted: " + e);
		} 
		if (line == null) {
			if (D) Log.d(TAG, "" + System.currentTimeMillis() + " readLine() timeout");
			throw new TimeoutException(null);
		} 
		if (D) Log.d(TAG, "" + System.currentTimeMillis() + " readLine (" + line.length() + "): " + line);
		return line;
	} 
 
	public void writeLine(String line) throws IOException {
		line += "\r";
		if (D) Log.d(TAG, "" + System.currentTimeMillis() + " writeLine: " + line);
Connect your IDE to all the code out there  Get Codota for Java