@Override public int readShort() { return buffer.readShort(); }
@Override public int readShort() { return buffer.readShort(); }
public short readShort() throws IOException { checkAvailable(2); return buffer.readShort(); }
public short readShort() { checkReadableBytes(2); return buf().readShort(); }
/** * Returns the closing status code as per <a href="http://tools.ietf.org/html/rfc6455#section-7.4">RFC 6455</a>. If * a status code is set, -1 is returned. */ public int getStatusCode() { ChannelBuffer binaryData = getBinaryData(); if (binaryData == null || binaryData.capacity() == 0) { return -1; } binaryData.readerIndex(0); int statusCode = binaryData.readShort(); binaryData.readerIndex(0); return statusCode; }
private Object decodeV1(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception { buffer.resetReaderIndex(); buffer.skipBytes(2);// skip magic num byte messageType = (byte) buffer.readShort(); long requestId = buffer.readLong(); int dataLength = buffer.readInt(); // FIXME 如果dataLength过大,可能导致问题 if (buffer.readableBytes() < dataLength) { buffer.resetReaderIndex(); return null; } checkMaxContext(dataLength, ctx, channel, messageType == MotanConstants.FLAG_REQUEST, requestId); byte[] data = new byte[dataLength]; buffer.readBytes(data); return decode(data, channel, messageType == MotanConstants.FLAG_REQUEST, requestId); }
short type = buffer.readShort();
int statusCode = buffer.readShort(); if (statusCode >= 0 && statusCode <= 999 || statusCode >= 1004 && statusCode <= 1006 || statusCode >= 1012 && statusCode <= 2999) {
@Override public short readShort() { return buffer.readShort(); }
@Override public short getShort() throws IOException { try { return delegate.readShort(); } catch ( IndexOutOfBoundsException e ) { throw ReadPastEndException.INSTANCE; } }
private static String decodeString(final ChannelBuffer in) { final short size = in.readShort(); final byte[] bytes = new byte[size]; in.readBytes(bytes); return new String(bytes); // TODO UTF-8 ? }
/** * Reads the channel buffer and returns object of AutonomousSystemNumberSubObject. * * @param c type of channel buffer * @return object of AutonomousSystemNumberSubObject */ public static PcepValueType read(ChannelBuffer c) { short asNumber = c.readShort(); return new AutonomousSystemNumberSubObject(asNumber); }
/** * Reads the channel buffer and returns object of AutonomousSystemNumberSubObject. * * @param c type of channel buffer * @return object of AutonomousSystemNumberSubObject */ public static PcepValueType read(ChannelBuffer c) { short asNumber = c.readShort(); return new AutonomousSystemNumberSubObject(asNumber); }
@Override public short readShort() { readNextChunkIfNeeded( 2 ); return buffer.readShort(); }
/** * Reads the channel buffer and returns object of RpdCapabilityTlv. * @param cb type of channel buffer * @return object of RpdCapabilityTlv */ public static RpdCapabilityTlv read(ChannelBuffer cb) { short afi = cb.readShort(); byte sAfi = cb.readByte(); return RpdCapabilityTlv.of(cb.readByte()); }
/** * Reads from channel buffer and returns object of MultiprotocolCapabilityTlv. * @param cb of type channel buffer * @return object of MultiProtocolExtnCapabilityTlv */ public static BgpValueType read(ChannelBuffer cb) { short afi = cb.readShort(); byte res = cb.readByte(); byte safi = cb.readByte(); return new MultiProtocolExtnCapabilityTlv(afi, res, safi); }
@Override public void readFrom(final ChannelBuffer data) { super.readFrom(data); if (this.dataLayerAddress == null) { this.dataLayerAddress = new byte[OFPhysicalPort.OFP_ETH_ALEN]; } data.readBytes(this.dataLayerAddress); data.readInt(); data.readShort(); }
@Override public void readFrom(final ChannelBuffer data) { super.readFrom(data); this.networkTypeOfService = data.readByte(); data.readShort(); data.readByte(); }
@Override public void readFrom(final ChannelBuffer data) { if (this.match == null) { this.match = new OFMatch(); } this.match.readFrom(data); this.tableId = data.readByte(); data.readByte(); // pad this.outPort = data.readShort(); }