src/main/java/se/cgbystrom/netty/thrift/TNettyTransport.java
@Override
    public int read(final byte[] output, final int offset, final int length) throws TTransportException {
        int read = 0;
        int index = offset;
        int space = length - offset;
        while (space > 0) {
            byte aByte = readAsynchrously();
            output[index] = aByte;
            space--;
            index++;
            read++;
        }
        return read;
    }
@Override
    public int read(final byte[] output, final int offset, final int length) throws TTransportException {
        int read = 0;
        int index = offset;
        int space = length - offset;
        while (space > 0) {
            byte aByte = readAsynchrously();
            output[index] = aByte;
            space--;
            index++;
            read++;
        }
        return read;
    }
@ Override public int read ( final byte [ ] output , final int offset , final int length ) throws TTransportException { int read = 0 ; int index = offset ; int space = length - offset ; while ( space > 0 ) { byte aByte = readAsynchrously ( ) ; output [ index ] = aByte ; space -- ; index ++ ; read ++ ; } return read ; }
Reads from the shared input queue, blocking if there is not enough input
in the buffer. It's the only way we can emulate the synchronous nature of
TTransport using netty.
Reads from the shared input queue blocking if there is not enough input in the buffer . It s the only way we can emulate the synchronous nature of TTransport using netty .