public class BytesInputStream extends InputStream
BytesInputStream contains
an internal buffer that contains bytes that
may be read from the stream. An internal
counter keeps track of the next byte to
be supplied by the read method.
Closing a BytesInputStream has no effect. The methods in
this class can be called after the stream has been closed without
generating an IOException.
| Constructor and Description |
|---|
BytesInputStream(byte[] bytes)
Creates a
BytesInputStream
so that it uses bytes as its
buffer array. |
BytesInputStream(byte[] bytes,
int offset,
int length)
Creates
ByteArrayInputStream
that uses buf as its
buffer array. |
BytesInputStream(Bytes bytes)
Creates a
BytesInputStream
so that it uses bytes as its
buffer array. |
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
void |
close() |
void |
mark(int readAheadLimit) |
boolean |
markSupported() |
int |
read() |
int |
read(@NonNull byte[] bytes,
int offset,
int length) |
void |
reset() |
long |
skip(long skipBytes) |
readpublic BytesInputStream(byte[] bytes)
BytesInputStream
so that it uses bytes as its
buffer array.
The buffer array is not copied.bytes - the input buffer.public BytesInputStream(Bytes bytes)
BytesInputStream
so that it uses bytes as its
buffer array.
The buffer array is not copied.bytes - the input buffer.public BytesInputStream(byte[] bytes,
int offset,
int length)
ByteArrayInputStream
that uses buf as its
buffer array. The initial value of pos
is offset and the initial value
of count is the minimum of offset+length
and buf.length.
The buffer array is not copied. The buffer's mark is
set to the specified offset.bytes - the input buffer.offset - the offset in the buffer of the first byte to read.length - the maximum number of bytes to read from the buffer.public int read()
throws IOException
read in class InputStreamIOExceptionpublic int read(@NonNull
@NonNull byte[] bytes,
int offset,
int length)
read in class InputStreampublic long skip(long skipBytes)
skip in class InputStreampublic int available()
available in class InputStreampublic boolean markSupported()
markSupported in class InputStreampublic void mark(int readAheadLimit)
mark in class InputStreampublic void reset()
reset in class InputStreampublic void close()
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamCopyright © 2019–2020 Appulse. All rights reserved.