本文整理了Java中io.netty.buffer.ByteBuf.asReadOnly()
方法的一些代码示例,展示了ByteBuf.asReadOnly()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuf.asReadOnly()
方法的具体详情如下:
包路径:io.netty.buffer.ByteBuf
类名称:ByteBuf
方法名:asReadOnly
[英]Returns a read-only version of this buffer.
[中]返回此缓冲区的只读版本。
代码示例来源:origin: netty/netty
@Override
public ByteBuf asReadOnly() {
return buf.asReadOnly();
}
代码示例来源:origin: redisson/redisson
@Override
public ByteBuf asReadOnly() {
return buf.asReadOnly();
}
代码示例来源:origin: wildfly/wildfly
@Override
public ByteBuf asReadOnly() {
return buf.asReadOnly();
}
代码示例来源:origin: micronaut-projects/micronaut-core
@Override
public ByteBuf asReadOnly() {
return byteBuf.asReadOnly();
}
代码示例来源:origin: netty/netty
private static ByteBuf wrappedUnmodifiableBuffer(boolean copy, ByteBuf... buffers) {
switch (buffers.length) {
case 0:
return EMPTY_BUFFER;
case 1:
return buffers[0].asReadOnly();
default:
if (copy) {
buffers = Arrays.copyOf(buffers, buffers.length, ByteBuf[].class);
}
return new FixedCompositeByteBuf(ALLOC, buffers);
}
}
代码示例来源:origin: redisson/redisson
private static ByteBuf wrappedUnmodifiableBuffer(boolean copy, ByteBuf... buffers) {
switch (buffers.length) {
case 0:
return EMPTY_BUFFER;
case 1:
return buffers[0].asReadOnly();
default:
if (copy) {
buffers = Arrays.copyOf(buffers, buffers.length, ByteBuf[].class);
}
return new FixedCompositeByteBuf(ALLOC, buffers);
}
}
代码示例来源:origin: netty/netty
@Override
public ByteBuf asReadOnly() {
return buf.isReadOnly() ? this : new UnreleasableByteBuf(buf.asReadOnly());
}
代码示例来源:origin: wildfly/wildfly
private static ByteBuf wrappedUnmodifiableBuffer(boolean copy, ByteBuf... buffers) {
switch (buffers.length) {
case 0:
return EMPTY_BUFFER;
case 1:
return buffers[0].asReadOnly();
default:
if (copy) {
buffers = Arrays.copyOf(buffers, buffers.length, ByteBuf[].class);
}
return new FixedCompositeByteBuf(ALLOC, buffers);
}
}
代码示例来源:origin: redisson/redisson
@Override
public ByteBuf asReadOnly() {
return buf.isReadOnly() ? this : new UnreleasableByteBuf(buf.asReadOnly());
}
代码示例来源:origin: wildfly/wildfly
@Override
public ByteBuf asReadOnly() {
return buf.isReadOnly() ? this : new UnreleasableByteBuf(buf.asReadOnly());
}
代码示例来源:origin: wildfly/wildfly
@Override
public ActiveMQBuffer getReadOnlyBodyBuffer() {
checkEncode();
internalWritableBuffer();
return new ChannelBufferWrapper(buffer.slice(BODY_OFFSET, endOfBodyPosition - BUFFER_HEADER_SPACE).setIndex(0, endOfBodyPosition - BUFFER_HEADER_SPACE).asReadOnly());
}
代码示例来源:origin: rsocket/rsocket-java
@Override
public ByteBuf getUnsafeFrame() {
return byteBuf.asReadOnly();
}
}
代码示例来源:origin: io.netty/netty-buffer
@Override
public ByteBuf asReadOnly() {
return buf.asReadOnly();
}
代码示例来源:origin: rsocket/rsocket-java
public final ByteBuf getUnsafeFrame() {
return byteBuf.asReadOnly();
}
代码示例来源:origin: rsocket/rsocket-java
@Override
public ByteBuf getUnsafeFrame() {
return byteBuf.asReadOnly();
}
}
代码示例来源:origin: io.netty/netty-buffer
private static ByteBuf wrappedUnmodifiableBuffer(boolean copy, ByteBuf... buffers) {
switch (buffers.length) {
case 0:
return EMPTY_BUFFER;
case 1:
return buffers[0].asReadOnly();
default:
if (copy) {
buffers = Arrays.copyOf(buffers, buffers.length, ByteBuf[].class);
}
return new FixedCompositeByteBuf(ALLOC, buffers);
}
}
代码示例来源:origin: rsocket/rsocket-java
/**
* Returns the data.
*
* @param dataOffset the offset that the data starts at, relative to start of the {@link ByteBuf}
* @return the data
*/
final ByteBuf getData(int dataOffset) {
ByteBuf byteBuf = getByteBuf();
return byteBuf.slice(dataOffset, byteBuf.readableBytes() - dataOffset).asReadOnly();
}
}
代码示例来源:origin: io.netty/netty-buffer
@Override
public ByteBuf asReadOnly() {
return buf.isReadOnly() ? this : new UnreleasableByteBuf(buf.asReadOnly());
}
代码示例来源:origin: rsocket/rsocket-java
/**
* Returns the data.
*
* @param metadataLengthOffset the offset that the metadataLength starts at, relative to start of
* the {@link ByteBuf}
* @return the data
*/
final ByteBuf getData(int metadataLengthOffset) {
int dataOffset = getDataOffset(metadataLengthOffset);
ByteBuf byteBuf = getByteBuf();
return byteBuf.slice(dataOffset, byteBuf.readableBytes() - dataOffset).asReadOnly();
}
代码示例来源:origin: rsocket/rsocket-java
/**
* Returns the metadata.
*
* @param metadataOffset the offset that the metadata starts at, relative to start of the {@link
* ByteBuf}
* @return the metadata or {@code null} if the metadata flag is not set
*/
final @Nullable ByteBuf getMetadata(int metadataOffset) {
if (!isFlagSet(FLAG_METADATA)) {
return null;
}
ByteBuf byteBuf = getByteBuf();
return byteBuf.slice(metadataOffset, byteBuf.readableBytes() - metadataOffset).asReadOnly();
}
}
内容来源于网络,如有侵权,请联系作者删除!