Class EntityInputStream
java.lang.Object
java.io.InputStream
org.glassfish.jersey.innate.io.InputStreamWrapper
org.glassfish.jersey.message.internal.EntityInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
public class EntityInputStream
extends org.glassfish.jersey.innate.io.InputStreamWrapper
Entity input stream customized for entity message processing:
- Author:
- Marek Potociar
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static EntityInputStreamcreate(InputStream inputStream) Create an entity input stream instance wrapping the original input stream.voidCheck that the entity input stream has not been closed yet.protected InputStreamReturn the wrapped streamfinal InputStreamGet the wrapped input stream instance.booleanisClosed()Get the closed status of this input stream.booleanisEmpty()Check if the underlying entity stream is empty.voidreset()final voidsetWrappedStream(InputStream wrapped) Set the wrapped input stream instance.Methods inherited from class org.glassfish.jersey.innate.io.InputStreamWrapper
available, getWrappedIOE, mark, markSupported, read, read, read, readAllBytes, readNBytes, skip, transferToMethods inherited from class java.io.InputStream
nullInputStream, readNBytes, skipNBytes
-
Constructor Details
-
EntityInputStream
Extension constructor.- Parameters:
input- underlying wrapped input stream.
-
-
Method Details
-
create
Create an entity input stream instance wrapping the original input stream. In case the original entity stream is already of typeEntityInputStream, the stream is returned without wrapping.- Parameters:
inputStream- input stream.- Returns:
- entity input stream.
-
reset
public void reset()The method is customized to not throw an
IOExceptionif the reset operation fails. Instead, a runtimeProcessingExceptionis thrown.- Overrides:
resetin classorg.glassfish.jersey.innate.io.InputStreamWrapper- Throws:
ProcessingException- in case the reset operation on the underlying entity input stream failed.
-
close
The method is customized to not throw an
IOExceptionif the close operation fails. Instead, a warning message is logged.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classorg.glassfish.jersey.innate.io.InputStreamWrapper- Throws:
ProcessingException
-
isEmpty
public boolean isEmpty()Check if the underlying entity stream is empty.Note that the operation may need to block until a first byte (or EOF) is available in the stream.
- Returns:
trueif the entity stream is empty,falseotherwise.
-
ensureNotClosed
Check that the entity input stream has not been closed yet.- Throws:
IllegalStateException- in case the entity input stream has been closed.
-
isClosed
public boolean isClosed()Get the closed status of this input stream.- Returns:
trueif the stream has been closed,falseotherwise.
-
getWrappedStream
Get the wrapped input stream instance.- Returns:
- wrapped input stream instance.
-
setWrappedStream
Set the wrapped input stream instance.- Parameters:
wrapped- new input stream instance to be wrapped.
-
getWrapped
Description copied from class:org.glassfish.jersey.innate.io.InputStreamWrapperReturn the wrapped stream- Specified by:
getWrappedin classorg.glassfish.jersey.innate.io.InputStreamWrapper- Returns:
-