public class PartInputStream
extends java.io.InputStream
Constructor and Description |
---|
PartInputStream(MultipartSplitter splitter)
Create a new
PartInputStream backed
by a given (shared) MultipartSplitter . |
Modifier and Type | Method and Description |
---|---|
int |
available() |
void |
close()
Closes this input stream and releases any system
resources associated with the stream.
|
void |
mark(int readlimit)
Marks the current position in this input
stream.
|
boolean |
markSupported()
Tests if this input stream supports the mark and
reset methods.
|
int |
read()
Reads the next byte of data from the input
stream.
|
int |
read(byte[] buf)
Reads some number of bytes from the input stream
and stores them into the buffer array b.
|
int |
read(byte[] buf,
int offset, int len)
Reads up to
len bytes of data from
the input stream into an array of bytes. |
void |
reset()
Repositions this stream to the position at the
time the mark method was last called on this input stream.
|
long |
skip(long n)
Skips over and discards n bytes of data from
this input stream.
|
public PartInputStream(MultipartSplitter splitter)
PartInputStream
backed
by a given (shared) MultipartSplitter
. This input
stream will return bytes until the underlying
MultipartSplitter
detects an end-of-part boundary, in
which case the PartInputStream
returns a length of -1
as an EOF indicator.public int available()
available
in
class java.io.InputStream
public void close()
close
in
interface java.io.Closeable
close
in
interface java.lang.AutoCloseable
close
in
class java.io.InputStream
public void mark(int readlimit)
mark
in
class java.io.InputStream
public boolean markSupported()
markSupported
in
class java.io.InputStream
public int read() throws java.io.IOException
read
in
class java.io.InputStream
java.io.IOException
public int read(byte[] buf) throws java.io.IOException
read
in
class java.io.InputStream
java.io.IOException
public int read(byte[] buf, int offset, int len) throws java.io.IOException
len
bytes of data from
the input stream into an array of bytes. An attempt is made to read
as many as len
bytes, but a smaller number may be
read, possibly zero. The number of bytes actually read is returned
as an integer.
This method blocks until input data is available, end of file is detected, or an exception is thrown.
If buf
is null
, a
NullPointerException
is thrown.
If offset
is negative, or len
is
negative, or offset+len
is greater than the length of
the array buf
, then an
IndexOutOfBoundsException
is thrown.
If len
is zero, then no bytes are read and
0
is returned; otherwise, there is an attempt to read
at least one byte. If no byte is available because the stream is at
end of file, the value -1
is returned; otherwise, at
least one byte is read and stored into buf
.
In every case, elements buf[0]
through
buf[offset]
and elements buf[offset+len]
through buf[buf.length-1]
are unaffected.
If the first byte cannot be read for any reason other than end
of file, then an IOException
is thrown. In particular,
an IOException
is thrown if the input stream has been
closed.
read
in
class java.io.InputStream
buf
- - the buffer into which the data is
read.offset
- - the start offset in array
b
at which the data is written.len
- - the maximum number of bytes to read.-1
if there is no more data because the end of the
stream has been reached.java.io.IOException
- - if an I/O error
occurs.public void reset()
reset
in
class java.io.InputStream
public long skip(long n) throws java.io.IOException
skip
in
class java.io.InputStream
java.io.IOException
Copyright © 2024 MarkLogic
Corporation
Complete online documentation for MarkLogic Server,
XQuery and related components may
be found at
developer.marklogic.com