Package com.yahoo.jdisc.handler
Class UnsafeContentInputStream
java.lang.Object
java.io.InputStream
com.yahoo.jdisc.handler.UnsafeContentInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
ContentInputStream
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.
- Author:
- Simon Thoresen Hult
-
Constructor Summary
ConstructorDescriptionConstructs a new ContentInputStream that reads from the givenReadableContentChannel
. -
Method Summary
Methods inherited from class java.io.InputStream
nullInputStream, read, readAllBytes, readNBytes, readNBytes, skip, skipNBytes, transferTo
-
Constructor Details
-
UnsafeContentInputStream
Constructs a new ContentInputStream that reads from the given
ReadableContentChannel
.- Parameters:
content
- The content to read the stream from.
-
-
Method Details
-
read
public int read()- Specified by:
read
in classInputStream
-
read
public int read(byte[] buf, int off, int len) - Overrides:
read
in classInputStream
-
available
public int available()- Overrides:
available
in classInputStream
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
-
mark
public void mark(int readlimit) - Overrides:
mark
in classInputStream
-
reset
- Overrides:
reset
in classInputStream
- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupported
in classInputStream
-