public class UnsafeContentInputStream extends InputStream
This class provides an adapter from a ReadableContentChannel
to an InputStream. This class supports all
regular InputStream operations, and can be combined with any other InputStream API.
Because this class encapsulates the reference-counted ContentChannel
operations, one must be sure to
always call close()
before discarding it. Failure to do so will prevent the Container from ever shutting
down.
Modifier and Type | Field and Description |
---|---|
private ByteBuffer |
buf |
private ReadableContentChannel |
content |
Constructor and Description |
---|
UnsafeContentInputStream(ReadableContentChannel content)
Constructs a new ContentInputStream that reads from the given
ReadableContentChannel . |
Modifier and Type | Method and Description |
---|---|
int |
available() |
void |
close() |
int |
read() |
int |
read(byte[] buf,
int off,
int len) |
mark, markSupported, read, reset, skip
private final ReadableContentChannel content
private ByteBuffer buf
public UnsafeContentInputStream(ReadableContentChannel content)
Constructs a new ContentInputStream that reads from the given ReadableContentChannel
.
content
- The content to read the stream from.public int read()
read
in class InputStream
public int read(byte[] buf, int off, int len)
read
in class InputStream
public int available()
available
in class InputStream
public void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
Copyright © 2018. All rights reserved.