Package io.netty.buffer

Examples of io.netty.buffer.ByteBuf.capacity()


        //
        // If desperate, _might_ be able to hack it with a dummy CharacterEncoder if there is
        // no security manager. Otherwise have to class path boot etc to get into the lang
        // package. I suppose annoyances like these are why I made this package.
        ByteBuf slice = content().slice();
        char[] values = new char[slice.capacity()];
        if (slice.readableBytes() > 0) {
            for (int i = 0; i < slice.capacity(); i++) {
                values[i] = (char) slice.getByte(i);
            }
        } else {
View Full Code Here


        // no security manager. Otherwise have to class path boot etc to get into the lang
        // package. I suppose annoyances like these are why I made this package.
        ByteBuf slice = content().slice();
        char[] values = new char[slice.capacity()];
        if (slice.readableBytes() > 0) {
            for (int i = 0; i < slice.capacity(); i++) {
                values[i] = (char) slice.getByte(i);
            }
        } else {
            return "";
        }
View Full Code Here

    try
    {
      cb.writeToStream( stream );
      packet.writeInt( stream.readableBytes() );
      stream.capacity( stream.readableBytes() );
      packet.writeByteArray( stream.array() );
    }
    catch (IOException e)
    {
      AELog.error( e );
View Full Code Here

    catch (Throwable t)
    {
      AELog.error( t );
    }

    stream.capacity( stream.readableBytes() );
    data.setByteArray( "X", stream.array() );
    return new S35PacketUpdateTileEntity( xCoord, yCoord, zCoord, 64, data );
  }

  @Override
View Full Code Here

        bootstrapEnv(3, 1);
        final int BUFFER_SIZE = 1 << 16;
        final ByteBuf data = Unpooled.buffer(BUFFER_SIZE);
        final EmbeddedChannel encoder = new EmbeddedChannel(ZlibCodecFactory.newZlibEncoder(ZlibWrapper.ZLIB));
        try {
            for (int i = 0; i < data.capacity(); ++i) {
                data.writeByte((byte) 'a');
            }
            final ByteBuf encodedData = encodeData(data, encoder);
            final Http2Headers headers =
                    new DefaultHttp2Headers().method(POST).path(PATH)
View Full Code Here

    public EchoMessageHandler(final Meter meter, final int messageSize) {
        this.meter = meter;

        final ByteBuf byteBuf = Unpooled.buffer(messageSize);

        for (int i = 0; i < byteBuf.capacity(); i++) {
            byteBuf.writeByte((byte) i);
        }

        message = new UdtMessage(byteBuf);
    }
View Full Code Here

                    buffer = ((HttpData) currentData).getChunk(sizeleft);
                } catch (IOException e) {
                    throw new ErrorDataEncoderException(e);
                }
            }
            if (buffer.capacity() == 0) {
                // end for current InterfaceHttpData, need more data
                currentData = null;
                return null;
            }
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.