Java Code Examples for io.netty.buffer.ByteBuf.readLongLE()

The following are Jave code examples for showing how to use readLongLE() of the io.netty.buffer.ByteBuf class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: JRediClients   File: JCacheEventCodec.java   Source Code and License Vote up 5 votes
@Override
    public Object decode(ByteBuf buf, State state) throws IOException {
        List<Object> result = new ArrayList<Object>();
        int keyLen;
        if (PlatformDependent.isWindows()) {
keyLen = buf.readIntLE();
        } else {
keyLen = (int) buf.readLongLE();
        }
        ByteBuf keyBuf = buf.readSlice(keyLen);
        Object key = codec.getMapKeyDecoder().decode(keyBuf, state);
        result.add(key);

        int valueLen;
        if (PlatformDependent.isWindows()) {
valueLen = buf.readIntLE();
        } else {
valueLen = (int) buf.readLongLE();
        }
        ByteBuf valueBuf = buf.readSlice(valueLen);
        Object value = codec.getMapValueDecoder().decode(valueBuf, state);
        result.add(value);
        
        if (sync) {
            double syncId = buf.order(ByteOrder.LITTLE_ENDIAN).readDouble();
            result.add(syncId);
        }
        
        return result;
    }
 
Example 2
Project: JRediClients   File: MapCacheEventCodec.java   Source Code and License Vote up 5 votes
private Object decode(ByteBuf buf, State state, Decoder<?> decoder) throws IOException {
     int keyLen;
     if (PlatformDependent.isWindows()) {
keyLen = buf.readIntLE();
     } else {
keyLen = (int) buf.readLongLE();
     }
     ByteBuf keyBuf = buf.readSlice(keyLen);
     Object key = decoder.decode(keyBuf, state);
     return key;
 }