protected void decodePacketLen() throws IOException {
		// read next packetlen
		// check for partial length
		int first = buf[inputPos] & 0xFF;
		if (first >= 224 && first < 255) {
			packetLen = 1 << (first & 0x1F);
			partial = true;
			inputPos++;
			inputLen--;
		} else {
			int reqlen = decodeLengthSpace(first);
			if (inputLen < reqlen) {
				// read in the rest
				inputLen += readBlocking(buf, inputPos + inputLen, reqlen
						- inputLen);
				if (inputLen < reqlen) {
					throw new IOException("Error in datastream");
				}
			}
			packetLen = decodeLength(buf, inputPos, reqlen);
			inputPos += reqlen;
			inputLen -= reqlen;
			partial = false;
		}
	}