Package org.apache.axiom.om.util
Class DetachableInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- org.apache.axiom.om.util.DetachableInputStream
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class DetachableInputStream extends FilterInputStream
Deprecated.FilterInputStream that delegates to the original InputStream. When detach() is called, the original InputStream is consumed, and closed. The unread bytes are stored in a local stream. Subsequent requests are serviced by the local stream. Rationale: The detached stream can be closed and its resources freed, but the consumer of the stream can continue to receive data. Cons: If there are a lot of bytes remaining, these are buffered. Currently they are buffered incore (this could be improved to buffer in a file).
-
-
Field Summary
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description DetachableInputStream(InputStream in)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
available()
Deprecated.void
close()
Deprecated.void
detach()
Deprecated.Consume the input stream and close it.long
length()
Deprecated.void
mark(int readlimit)
Deprecated.boolean
markSupported()
Deprecated.int
read()
Deprecated.int
read(byte[] b)
Deprecated.int
read(byte[] b, int off, int len)
Deprecated.void
reset()
Deprecated.long
skip(long n)
Deprecated.-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
DetachableInputStream
public DetachableInputStream(InputStream in)
Deprecated.
-
-
Method Detail
-
length
public long length() throws IOException
Deprecated.- Returns:
- count of bytes read
- Throws:
IOException
-
detach
public void detach() throws IOException
Deprecated.Consume the input stream and close it. The bytes in the input stream are buffered. (Thus the original input stream can release its resources, but the consumer of the stream can still receive data).- Throws:
IOException
-
available
public int available() throws IOException
Deprecated.- Overrides:
available
in classFilterInputStream
- Throws:
IOException
-
close
public void close() throws IOException
Deprecated.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterInputStream
- Throws:
IOException
-
markSupported
public boolean markSupported()
Deprecated.- Overrides:
markSupported
in classFilterInputStream
-
mark
public void mark(int readlimit)
Deprecated.- Overrides:
mark
in classFilterInputStream
-
read
public int read() throws IOException
Deprecated.- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException
Deprecated.- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
public int read(byte[] b) throws IOException
Deprecated.- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
reset
public void reset() throws IOException
Deprecated.- Overrides:
reset
in classFilterInputStream
- Throws:
IOException
-
skip
public long skip(long n) throws IOException
Deprecated.- Overrides:
skip
in classFilterInputStream
- Throws:
IOException
-
-