|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
org.eclipse.webdav.http.client.RequestInputStream
public class RequestInputStream
A resettable InputStream
.
Note: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.
Constructor Summary | |
---|---|
RequestInputStream(byte[] b)
Creates a RequestInputStream on the given byte array. |
|
RequestInputStream(ByteArrayInputStream bais)
Creates a RequestInputStream on the given
ByteArrayInputStream . |
|
RequestInputStream(File file)
Creates a RequestInputStream on the given file. |
|
RequestInputStream(InputStream is,
long length)
Creates a RequestInputStream on the given
InputStream . |
Method Summary | |
---|---|
void |
close()
|
long |
length()
Returns the length of the stream, or -1 if the length of the stream is unknown. |
int |
read()
|
int |
read(byte[] b,
int off,
int len)
|
void |
reset()
Resets the stream to its beginning so it can be read again. |
Methods inherited from class java.io.InputStream |
---|
available, mark, markSupported, read, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RequestInputStream(byte[] b)
RequestInputStream
on the given byte array.
b
- the underlying byte arraypublic RequestInputStream(ByteArrayInputStream bais)
RequestInputStream
on the given
ByteArrayInputStream
.
bais
- the underlying input streampublic RequestInputStream(File file) throws IOException
RequestInputStream
on the given file.
file
- the underlying file
IOException
- if there is a problem opening the filepublic RequestInputStream(InputStream is, long length) throws IOException
RequestInputStream
on the given
InputStream
. The length of the stream is set to be the
given length. If the length of the stream is unknown, the given length
must be -1.
Note that to enable reset on streams created using this constructor, the streams content is written to a temporary file while the stream is read. This results in a loss of performance, so use this constructor as a last resort.
is
- the underlying input streamlength
- the length of the stream, or -1 if the length is unknown
IOException
- if there is a problem creating or opening the
temporary fileMethod Detail |
---|
public void close() throws IOException
close
in interface Closeable
close
in class InputStream
IOException
InputStream.close()
public long length()
public int read() throws IOException
read
in class InputStream
IOException
InputStream.read()
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
InputStream.read(byte[], int, int)
public void reset() throws IOException
reset
in class InputStream
IOException
- if there is an I/O error
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |