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.-
Field Summary
Fields inherited from interface org.apache.camel.StreamCache
DEFAULT_SPOOL_THRESHOLD
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.camel.StreamCache
copy
(org.apache.camel.Exchange exchange) boolean
inMemory()
long
length()
boolean
long
position()
int
read()
int
read
(byte[] b) int
read
(byte[] b, int off, int len) void
release()
Release the buffer when we are done using it.void
reset()
void
writeTo
(OutputStream os) Methods inherited from class java.io.InputStream
available, close, mark, nullInputStream, readAllBytes, readNBytes, readNBytes, skip, skipNBytes, transferTo
-
Constructor Details
-
NettyChannelBufferStreamCache
public NettyChannelBufferStreamCache(io.netty.buffer.ByteBuf buffer)
-
-
Method Details
-
markSupported
public boolean markSupported()- Overrides:
markSupported
in classInputStream
-
read
public int read()- Specified by:
read
in classInputStream
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) - Overrides:
read
in classInputStream
-
reset
public void reset()- Specified by:
reset
in interfaceorg.apache.camel.StreamCache
- Overrides:
reset
in classInputStream
-
writeTo
- Specified by:
writeTo
in interfaceorg.apache.camel.StreamCache
- Throws:
IOException
-
copy
public org.apache.camel.StreamCache copy(org.apache.camel.Exchange exchange) - Specified by:
copy
in interfaceorg.apache.camel.StreamCache
-
inMemory
public boolean inMemory()- Specified by:
inMemory
in interfaceorg.apache.camel.StreamCache
-
length
public long length()- Specified by:
length
in interfaceorg.apache.camel.StreamCache
-
position
public long position()- Specified by:
position
in interfaceorg.apache.camel.StreamCache
-
release
public void release()Release the buffer when we are done using it.
-