All pastes #476501 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-05-08 03:35 UTC
rendered paste body
public void run() {
		try {
			int b;
			boolean msg = false;
			buf = ByteBuffer.allocate(is.available());
			
			while ((b = is.read()) != -1) {
				if(((byte)b == INICIO_MENSAGEM)) {
					//estou a receber uma mensagem.
					msg = true;
				} else if(msg && is.available() > 0) {
					buf.put((byte)b);
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}