Tabnine Logo
Unpooled.wrappedBuffer
Code IndexAdd Tabnine to your IDE (free)

How to use
wrappedBuffer
method
in
io.netty.buffer.Unpooled

Best Java code snippets using io.netty.buffer.Unpooled.wrappedBuffer (Showing top 20 results out of 3,321)

origin: netty/netty

/**
 * Creates a new big-endian composite buffer which wraps the slices of the specified
 * NIO buffers without copying them.  A modification on the content of the
 * specified buffers will be visible to the returned buffer.
 */
public static ByteBuf wrappedBuffer(ByteBuffer... buffers) {
  return wrappedBuffer(buffers.length, buffers);
}
origin: netty/netty

/**
 * Creates a new big-endian composite buffer which wraps the slices of the specified
 * NIO buffers without copying them.  A modification on the content of the
 * specified buffers will be visible to the returned buffer.
 */
public static ByteBuf wrappedBuffer(int maxNumComponents, ByteBuffer... buffers) {
  return wrappedBuffer(maxNumComponents, CompositeByteBuf.BYTE_BUFFER_WRAPPER, buffers);
}
origin: netty/netty

/**
 * Returns a {@code NUL (0x00)} delimiter, which could be used for
 * Flash XML socket or any similar protocols.
 */
public static ByteBuf[] nulDelimiter() {
  return new ByteBuf[] {
      Unpooled.wrappedBuffer(new byte[] { 0 }) };
}
origin: netty/netty

/**
 * Creates a new big-endian composite buffer which wraps the readable bytes of the
 * specified buffers without copying them.  A modification on the content
 * of the specified buffers will be visible to the returned buffer.
 * @param buffers The buffers to wrap. Reference count ownership of all variables is transferred to this method.
 * @return The readable portion of the {@code buffers}. The caller is responsible for releasing this buffer.
 */
public static ByteBuf wrappedBuffer(ByteBuf... buffers) {
  return wrappedBuffer(buffers.length, buffers);
}
origin: netty/netty

/**
 * Creates a new big-endian composite buffer which wraps the specified
 * arrays without copying them.  A modification on the specified arrays'
 * content will be visible to the returned buffer.
 */
public static ByteBuf wrappedBuffer(int maxNumComponents, byte[]... arrays) {
  return wrappedBuffer(maxNumComponents, CompositeByteBuf.BYTE_ARRAY_WRAPPER, arrays);
}
origin: netty/netty

@Override
public ByteBuf wrap(byte[] bytes) {
  return Unpooled.wrappedBuffer(bytes);
}
@Override
origin: netty/netty

@Override
public ByteBuf wrap(ByteBuffer bytes) {
  return Unpooled.wrappedBuffer(bytes);
}
@Override
origin: netty/netty

  @Override
  protected void encode(ChannelHandlerContext ctx, byte[] msg, List<Object> out) throws Exception {
    out.add(Unpooled.wrappedBuffer(msg));
  }
}
origin: apache/incubator-dubbo

@Override
public void run() {
  if (welcome != null) {
    ctx.write(Unpooled.wrappedBuffer(welcome.getBytes()));
    ctx.writeAndFlush(Unpooled.wrappedBuffer(prompt.getBytes()));
  }
}
origin: apache/incubator-dubbo

@Override
public void run() {
  if (welcome != null) {
    ctx.write(Unpooled.wrappedBuffer(welcome.getBytes()));
    ctx.writeAndFlush(Unpooled.wrappedBuffer(prompt.getBytes()));
  }
}
origin: apache/incubator-dubbo

  @Override
  public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
    if (!acceptForeignIp) {
      if (!((InetSocketAddress) ctx.channel().remoteAddress()).getAddress().isLoopbackAddress()) {
        ByteBuf cb = Unpooled.wrappedBuffer((QosConstants.BR_STR + "Foreign Ip Not Permitted."
            + QosConstants.BR_STR).getBytes());
        ctx.writeAndFlush(cb).addListener(ChannelFutureListener.CLOSE);
      }
    }
  }
}
origin: apache/incubator-dubbo

private static final FullHttpResponse http200(String result) {
  FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK,
      Unpooled.wrappedBuffer(result.getBytes()));
  HttpHeaders httpHeaders = response.headers();
  httpHeaders.set(HttpHeaders.Names.CONTENT_TYPE, "text/plain");
  httpHeaders.set(HttpHeaders.Names.CONTENT_LENGTH, response.content().readableBytes());
  return response;
}
origin: apache/incubator-dubbo

private static final FullHttpResponse http200(String result) {
  FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK,
      Unpooled.wrappedBuffer(result.getBytes()));
  HttpHeaders httpHeaders = response.headers();
  httpHeaders.set(HttpHeaders.Names.CONTENT_TYPE, "text/plain");
  httpHeaders.set(HttpHeaders.Names.CONTENT_LENGTH, response.content().readableBytes());
  return response;
}
origin: apache/incubator-dubbo

private static final FullHttpResponse http500(String errorMessage) {
  FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.INTERNAL_SERVER_ERROR
      , Unpooled.wrappedBuffer(errorMessage.getBytes()));
  HttpHeaders httpHeaders = response.headers();
  httpHeaders.set(HttpHeaders.Names.CONTENT_TYPE, "text/plain");
  httpHeaders.set(HttpHeaders.Names.CONTENT_LENGTH, response.content().readableBytes());
  return response;
}
origin: apache/incubator-dubbo

private static final FullHttpResponse http500(String errorMessage) {
  FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.INTERNAL_SERVER_ERROR
      , Unpooled.wrappedBuffer(errorMessage.getBytes()));
  HttpHeaders httpHeaders = response.headers();
  httpHeaders.set(HttpHeaders.Names.CONTENT_TYPE, "text/plain");
  httpHeaders.set(HttpHeaders.Names.CONTENT_LENGTH, response.content().readableBytes());
  return response;
}
origin: apache/incubator-dubbo

  @Override
  public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
    if (!acceptForeignIp) {
      if (!((InetSocketAddress) ctx.channel().remoteAddress()).getAddress().isLoopbackAddress()) {
        ByteBuf cb = Unpooled.wrappedBuffer((QosConstants.BR_STR + "Foreign Ip Not Permitted."
            + QosConstants.BR_STR).getBytes());
        ctx.writeAndFlush(cb).addListener(ChannelFutureListener.CLOSE);
      }
    }
  }
}
origin: spring-projects/spring-framework

@Override
public NettyDataBuffer wrap(ByteBuffer byteBuffer) {
  ByteBuf byteBuf = Unpooled.wrappedBuffer(byteBuffer);
  return new NettyDataBuffer(byteBuf, this);
}
origin: spring-projects/spring-framework

@Override
public DataBuffer wrap(byte[] bytes) {
  ByteBuf byteBuf = Unpooled.wrappedBuffer(bytes);
  return new NettyDataBuffer(byteBuf, this);
}
origin: netty/netty

/**
 * Creates a new big-endian buffer whose content is a copy of the
 * specified {@code array}.  The new buffer's {@code readerIndex} and
 * {@code writerIndex} are {@code 0} and {@code array.length} respectively.
 */
public static ByteBuf copiedBuffer(byte[] array) {
  if (array.length == 0) {
    return EMPTY_BUFFER;
  }
  return wrappedBuffer(array.clone());
}
origin: netty/netty

  @Override
  protected void encode(ChannelHandlerContext ctx, MessageLiteOrBuilder msg, List<Object> out)
      throws Exception {
    if (msg instanceof MessageLite) {
      out.add(wrappedBuffer(((MessageLite) msg).toByteArray()));
      return;
    }
    if (msg instanceof MessageLite.Builder) {
      out.add(wrappedBuffer(((MessageLite.Builder) msg).build().toByteArray()));
    }
  }
}
io.netty.bufferUnpooledwrappedBuffer

Javadoc

Creates a new big-endian composite buffer which wraps the readable bytes of the specified buffers without copying them. A modification on the content of the specified buffers will be visible to the returned buffer.

Popular methods of Unpooled

  • buffer
    Creates a new big-endian Java heap buffer with the specified initialCapacity, that may grow up to ma
  • copiedBuffer
    Creates a new big-endian buffer whose content is a merged copy of the specified arrays. The new buff
  • compositeBuffer
    Returns a new big-endian composite buffer with no components.
  • directBuffer
    Creates a new big-endian direct buffer with the specified initialCapacity, that may grow up to maxCa
  • unreleasableBuffer
    Return a unreleasable view on the given ByteBuf which will just ignore release and retain calls.
  • copyLong
    Create a new big-endian buffer that holds a sequence of the specified 64-bit integers.
  • copyShort
    Create a new big-endian buffer that holds a sequence of the specified 16-bit integers.
  • unmodifiableBuffer
    Wrap the given ByteBufs in an unmodifiable ByteBuf. Be aware the returned ByteBuf will not try to sl
  • wrappedUnmodifiableBuffer
    Wrap the given ByteBufs in an unmodifiable ByteBuf. Be aware the returned ByteBuf will not try to sl
  • copyInt
    Create a big-endian buffer that holds a sequence of the specified 32-bit integers.
  • copyMedium
    Create a new big-endian buffer that holds a sequence of the specified 24-bit integers.
  • copyDouble
    Create a new big-endian buffer that holds a sequence of the specified 64-bit floating point numbers.
  • copyMedium,
  • copyDouble,
  • copyFloat

Popular in Java

  • Making http post requests using okhttp
  • onCreateOptionsMenu (Activity)
  • putExtra (Intent)
  • setScale (BigDecimal)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Path (java.nio.file)
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • ImageIO (javax.imageio)
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now