@Override public byte readByte() { return buf.readByte(); }
@Override public byte readByte() { return buf.readByte(); }
@Override public byte readByte() { return buf.readByte(); }
@Override public byte readByte() { return buf.readByte(); }
@Override public int read() throws IOException { if (buffer.isReadable()) { return buffer.readByte() & 0xff; } return -1; }
@Override public byte readByte() throws IOException { if (!buffer.isReadable()) { throw new EOFException(); } return buffer.readByte(); }
@Override public int read() throws IOException { if (!buffer.isReadable()) { return -1; } return buffer.readByte() & 0xff; }
@Override public byte readByte() { checkReadableBytes(1); return buffer.readByte(); }
@Override public byte readByte() { checkReadableBytes(1); return buffer.readByte(); }
@Override public int read() throws IOException { if (buffer.isReadable()) { return buffer.readByte() & 0xff; } return -1; }
@Override public int read() throws IOException { if (!buffer.isReadable()) { return -1; } return buffer.readByte() & 0xff; }
@Override public byte readByte() throws IOException { if (!buffer.isReadable()) { throw new EOFException(); } return buffer.readByte(); }
@Override protected void decode(ChannelHandlerContext ctx, ByteBuf byteBuf, List<Object> out) throws Exception { switch (state()) { case CHECK_PROTOCOL_VERSION: { if (byteBuf.readByte() != SocksProtocolVersion.SOCKS5.byteValue()) { out.add(SocksCommonUtils.UNKNOWN_SOCKS_RESPONSE); break; } checkpoint(State.READ_PREFERRED_AUTH_TYPE); } case READ_PREFERRED_AUTH_TYPE: { SocksAuthScheme authScheme = SocksAuthScheme.valueOf(byteBuf.readByte()); out.add(new SocksInitResponse(authScheme)); break; } default: { throw new Error(); } } ctx.pipeline().remove(this); }
@Override protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> out) throws Exception { switch (state()) { case CHECK_PROTOCOL_VERSION: { if (byteBuf.readByte() != SocksSubnegotiationVersion.AUTH_PASSWORD.byteValue()) { out.add(SocksCommonUtils.UNKNOWN_SOCKS_RESPONSE); break; } checkpoint(State.READ_AUTH_RESPONSE); } case READ_AUTH_RESPONSE: { SocksAuthStatus authStatus = SocksAuthStatus.valueOf(byteBuf.readByte()); out.add(new SocksAuthResponse(authStatus)); break; } default: { throw new Error(); } } channelHandlerContext.pipeline().remove(this); }
@Override protected BinaryMemcacheResponse decodeHeader(ByteBuf in) { BinaryMemcacheResponse header = new DefaultBinaryMemcacheResponse(); header.setMagic(in.readByte()); header.setOpcode(in.readByte()); if (header.getMagic() == FRAMING_MAGIC) { header.setFramingExtrasLength(in.readByte()); header.setKeyLength(in.readByte()); } else { header.setKeyLength(in.readShort()); } header.setExtrasLength(in.readByte()); header.setDataType(in.readByte()); header.setStatus(in.readShort()); header.setTotalBodyLength(in.readInt()); header.setOpaque(in.readInt()); header.setCAS(in.readLong()); return header; }
@Override protected BinaryMemcacheResponse decodeHeader(ByteBuf in) { BinaryMemcacheResponse header = new DefaultBinaryMemcacheResponse(); header.setMagic(in.readByte()); header.setOpcode(in.readByte()); if (header.getMagic() == FRAMING_MAGIC) { header.setFramingExtrasLength(in.readByte()); header.setKeyLength(in.readByte()); } else { header.setKeyLength(in.readShort()); } header.setExtrasLength(in.readByte()); header.setDataType(in.readByte()); header.setStatus(in.readShort()); header.setTotalBodyLength(in.readInt()); header.setOpaque(in.readInt()); header.setCAS(in.readLong()); return header; }
@Override protected BinaryMemcacheRequest decodeHeader(ByteBuf in) { BinaryMemcacheRequest header = new DefaultBinaryMemcacheRequest(); header.setMagic(in.readByte()); header.setOpcode(in.readByte()); header.setKeyLength(in.readShort()); header.setExtrasLength(in.readByte()); header.setDataType(in.readByte()); header.setReserved(in.readShort()); header.setTotalBodyLength(in.readInt()); header.setOpaque(in.readInt()); header.setCAS(in.readLong()); return header; }
@Override protected BinaryMemcacheRequest decodeHeader(ByteBuf in) { BinaryMemcacheRequest header = new DefaultBinaryMemcacheRequest(); header.setMagic(in.readByte()); header.setOpcode(in.readByte()); header.setKeyLength(in.readShort()); header.setExtrasLength(in.readByte()); header.setDataType(in.readByte()); header.setReserved(in.readShort()); header.setTotalBodyLength(in.readInt()); header.setOpaque(in.readInt()); header.setCAS(in.readLong()); return header; }
/** * Reads the next character into {@link #currentChar}. * * @param level the current level of nesting. * @throws EOFException if more input is needed. */ private void readNextChar(final JsonLevel level) throws EOFException { int readerIndex = content.readerIndex(); int lastWsIndex = content.forEachByte(wsProcessor); if (lastWsIndex == -1 && level != null) { throw NEED_MORE_DATA; } if (lastWsIndex > readerIndex) { this.content.skipBytes(lastWsIndex - readerIndex); this.content.discardReadBytes(); } this.currentChar = this.content.readByte(); }
/** * Reads the next character into {@link #currentChar}. * * @param level the current level of nesting. * @throws EOFException if more input is needed. */ private void readNextChar(final JsonLevel level) throws EOFException { int readerIndex = content.readerIndex(); int lastWsIndex = content.forEachByte(wsProcessor); if (lastWsIndex == -1 && level != null) { throw NEED_MORE_DATA; } if (lastWsIndex > readerIndex) { this.content.skipBytes(lastWsIndex - readerIndex); this.content.discardReadBytes(); } this.currentChar = this.content.readByte(); }