Class NettyChannelBufferStreamCache

java.lang.Object
java.io.InputStream
org.apache.camel.component.netty.http.NettyChannelBufferStreamCache
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.camel.StreamCache

public final class NettyChannelBufferStreamCache extends InputStream implements org.apache.camel.StreamCache
A ByteBuf which is exposed as an InputStream which makes it very easy to use by Camel and other Camel components. Also supported is StreamCache which allows the data to be re-read for example when doing content based routing with XPath.

Important: All the classes from the Camel release that implements StreamCache is NOT intended for end users to create as instances, but they are part of Camels stream-caching functionality.

  • Constructor Details

    • NettyChannelBufferStreamCache

      public NettyChannelBufferStreamCache(io.netty.buffer.ByteBuf buffer)
  • Method Details

    • markSupported

      public boolean markSupported()
      Overrides:
      markSupported in class InputStream
    • read

      public int read()
      Specified by:
      read in class InputStream
    • read

      public int read(byte[] b) throws IOException
      Overrides:
      read in class InputStream
      Throws:
      IOException
    • read

      public int read(byte[] b, int off, int len)
      Overrides:
      read in class InputStream
    • reset

      public void reset()
      Specified by:
      reset in interface org.apache.camel.StreamCache
      Overrides:
      reset in class InputStream
    • writeTo

      public void writeTo(OutputStream os) throws IOException
      Specified by:
      writeTo in interface org.apache.camel.StreamCache
      Throws:
      IOException
    • copy

      public org.apache.camel.StreamCache copy(org.apache.camel.Exchange exchange)
      Specified by:
      copy in interface org.apache.camel.StreamCache
    • inMemory

      public boolean inMemory()
      Specified by:
      inMemory in interface org.apache.camel.StreamCache
    • length

      public long length()
      Specified by:
      length in interface org.apache.camel.StreamCache
    • position

      public long position()
      Specified by:
      position in interface org.apache.camel.StreamCache
    • release

      public void release()
      Release the buffer when we are done using it.