Code example for ByteBuffer

Methods: getShort

0
	private ByteBuffer createPacket(short cmd) {
		return createPacket(cmd, 0);
	} 
 
	private void handleHello(ByteBuffer p) throws IOException {
		if (p.getShort() != PROTO_VERSION)
			throw new ProtocolException();
	} 
 
	private void handleFrameUpdate(ByteBuffer p) {
		final int frameCount = p.getInt();
		final int keys = p.getInt();
 
		synchronized (frameLock) {
			remoteKeys = keys;
			if (++remoteFrameCount == localFrameCount)
				frameLock.notify();
		} 
	} 
 
	private void handlePowerROM(ByteBuffer p) {