Java Code Examples for io.netty.buffer.Unpooled#unmodifiableBuffer()

The following examples show how to use io.netty.buffer.Unpooled#unmodifiableBuffer() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Resources.java    From cassandra-exporter with Apache License 2.0 5 votes vote down vote up
public static ByteBuf asByteBuf(final Class<?> clazz, final String name) {
    try (final InputStream stream = clazz.getResourceAsStream(name)) {
        final byte[] bytes = ByteStreams.toByteArray(stream);

        return Unpooled.unmodifiableBuffer(Unpooled.unreleasableBuffer(Unpooled.wrappedBuffer(bytes)));

    } catch (final IOException e) {
        throw new UncheckedIOException(e);
    }
}
 
Example 2
Source File: ReplayingDecoderByteBuf.java    From netty-4.1.22 with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public ByteBuf asReadOnly() {
    return Unpooled.unmodifiableBuffer(this);
}
 
Example 3
Source File: BufferedHttpOutputMessage.java    From vertx-rest-client with Apache License 2.0 4 votes vote down vote up
@Override
public ByteBuf getBody() {
    return Unpooled.unmodifiableBuffer(byteBuf);
}
 
Example 4
Source File: BufferedHttpInputMessage.java    From vertx-rest-client with Apache License 2.0 4 votes vote down vote up
@Override
public ByteBuf getBody() {
    return Unpooled.unmodifiableBuffer(data);
}
 
Example 5
Source File: MultipartHttpOutputMessage.java    From vertx-rest-client with Apache License 2.0 4 votes vote down vote up
@Override
public ByteBuf getBody() {
    return Unpooled.unmodifiableBuffer(byteBuf);
}
 
Example 6
Source File: ReplayingDecoderBuffer.java    From ProtocolSupportBungee with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public ByteBuf asReadOnly() {
	return Unpooled.unmodifiableBuffer(this);
}
 
Example 7
Source File: ReplayingDecoderBuffer.java    From ProtocolSupport with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public ByteBuf asReadOnly() {
	return Unpooled.unmodifiableBuffer(this);
}