/** * Overrides the {@link java.io.InputStream#read()}. Reads the next byte of * data from the input stream. * * @return the next byte of data, or <code>-1</code> if the end of the * stream is reached. * @throws IOException if an I/O error occurs. */ @Override public int read() throws IOException { int n; while ((n = read(oneByteBuf, 0, 1)) == 0) { //NOPMD /* no op */ } return (n == -1) ? -1 : oneByteBuf[0] & 0xff; }
@Override public void channelRead(ChannelHandlerContext ctx, Object data) throws Exception { byteChannel.feedData((ByteBuf) data); byte[] decryptedData = new byte[byteChannel.readableBytes()]; int offset = 0; while (offset < decryptedData.length) { offset += cis.read(decryptedData, offset, decryptedData.length - offset); } ctx.fireChannelRead(Unpooled.wrappedBuffer(decryptedData, 0, decryptedData.length)); }
@Override public void channelRead(ChannelHandlerContext ctx, Object data) throws Exception { byteChannel.feedData((ByteBuf) data); byte[] decryptedData = new byte[byteChannel.readableBytes()]; int offset = 0; while (offset < decryptedData.length) { offset += cis.read(decryptedData, offset, decryptedData.length - offset); } ctx.fireChannelRead(Unpooled.wrappedBuffer(decryptedData, 0, decryptedData.length)); }
@Override public void channelRead(ChannelHandlerContext ctx, Object data) throws Exception { byteChannel.feedData((ByteBuf) data); byte[] decryptedData = new byte[byteChannel.readableBytes()]; int offset = 0; while (offset < decryptedData.length) { offset += cis.read(decryptedData, offset, decryptedData.length - offset); } ctx.fireChannelRead(Unpooled.wrappedBuffer(decryptedData, 0, decryptedData.length)); }