public int readWsFrameLength() throws IOException {
		byte type = readRawByte();
		if (type == 0xFF) {
			return 0;
		} else if ((type & 0x80) == 0x80) {
			// If the MSB on type is set, decode the frame length
			long frameSize = 0;
			int lengthFieldSize = 0;
			byte b;
			do {
				b = readRawByte();
				frameSize <<= 7;
				frameSize |= b & 0x7f;
				lengthFieldSize++;
				if (lengthFieldSize > 8) {
					// Perhaps a malicious peer?
					throw new IOException(
							"ZippyBufferReader to long WebSocket frame.");
				}
			} while ((b & 0x80) == 0x80);
			return (int) frameSize;
		} else {
			throw new IOException("ZippyBufferReader get text WebSocket frame.");
		}
	}