StringBufferInputStream
open classStringBufferInputStream: InputStream
kotlin.Any | ||
↳ | java.io.InputStream | |
↳ | java.io.StringBufferInputStream |
This class allows an application to create an input stream in which the bytes read are supplied by the contents of a string. Applications can also read bytes from a byte array by using a ByteArrayInputStream
.
Only the low eight bits of each character in the string are used by this class.
Summary
Public constructors | |
---|---|
Creates a string input stream to read data from the specified string. |
Public methods | |
---|---|
open Int |
Returns the number of bytes that can be read from the input stream without blocking. |
open Int |
read() Reads the next byte of data from this input stream. |
open Int |
Reads up to |
open Unit |
reset() Resets the input stream to begin reading from the first character of this input stream's underlying buffer. |
open Long |
Skips |
Inherited functions | |
---|---|
Properties | |
---|---|
String! |
The string from which bytes are read. |
Int |
The number of valid characters in the input stream buffer. |
Int |
The index of the next character to read from the input stream buffer. |
Public constructors
StringBufferInputStream
StringBufferInputStream(s: String!)
Creates a string input stream to read data from the specified string.
Parameters | |
---|---|
s |
String!: the underlying input buffer. |
Public methods
available
open funavailable(): Int
Deprecated: Deprecated in Java.
Returns the number of bytes that can be read from the input stream without blocking.
Return | |
---|---|
Int |
the value of count - pos , which is the number of bytes remaining to be read from the input buffer. |
Exceptions | |
---|---|
java.io.IOException |
if an I/O error occurs. |
read
open funread(): Int
Deprecated: Deprecated in Java.
Reads the next byte of data from this input stream. The value byte is returned as an int
in the range 0
to 255
. If no byte is available because the end of the stream has been reached, the value -1
is returned.
The read
method of StringBufferInputStream
cannot block. It returns the low eight bits of the next character in this input stream's buffer.
Return | |
---|---|
Int |
the next byte of data, or -1 if the end of the stream is reached. |
Exceptions | |
---|---|
java.io.IOException |
if an I/O error occurs. |
read
open funread(
b: ByteArray!,
off: Int,
len: Int
): Int
Deprecated: Deprecated in Java.
Reads up to len
bytes of data from this input stream into an array of bytes.
The read
method of StringBufferInputStream
cannot block. It copies the low eight bits from the characters in this input stream's buffer into the byte array argument.
Parameters | |
---|---|
b |
ByteArray!: the buffer into which the data is read. |
off |
Int: the start offset of the data. |
len |
Int: the maximum number of bytes read. |
Return | |
---|---|
Int |
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached. |
Exceptions | |
---|---|
java.io.IOException |
If the first byte cannot be read for any reason other than end of file, or if the input stream has been closed, or if some other I/O error occurs. |
java.lang.NullPointerException |
If b is null . |
java.lang.IndexOutOfBoundsException |
If off is negative, len is negative, or len is greater than b.length - off |
reset
open funreset(): Unit
Deprecated: Deprecated in Java.
Resets the input stream to begin reading from the first character of this input stream's underlying buffer.
Exceptions | |
---|---|
java.io.IOException |
if this stream has not been marked or if the mark has been invalidated. |
skip
open funskip(n: Long): Long
Deprecated: Deprecated in Java.
Skips n
bytes of input from this input stream. Fewer bytes might be skipped if the end of the input stream is reached.
Parameters | |
---|---|
n |
Long: the number of bytes to be skipped. |
Return | |
---|---|
Long |
the actual number of bytes skipped. |
Exceptions | |
---|---|
java.io.IOException |
if an I/O error occurs. |
Properties
buffer
protected varbuffer: String!
Deprecated: Deprecated in Java.
The string from which bytes are read.
count
protected varcount: Int
Deprecated: Deprecated in Java.
The number of valid characters in the input stream buffer.
pos
protected varpos: Int
Deprecated: Deprecated in Java.
The index of the next character to read from the input stream buffer.