This class is deprecated.Use StringReader
Class Overview
StringBufferInputStream is a class for to allow a String to be used as an
InputStream.
Summary
| Fields |
|
protected
String |
buffer |
The String containing the data to read. |
|
protected
int |
count |
The total number of characters inside the buffer. |
|
protected
int |
pos |
The current position within the String buffer. |
| Public Methods |
|
synchronized
int
|
available()
Returns an int representing then number of characters that are available
to read.
|
|
synchronized
int
|
read(byte[] b, int offset, int length)
Reads at most length bytes from this InputStream and
stores them in byte array b starting at
offset.
|
|
synchronized
int
|
read()
Reads a single byte from this InputStream and returns the result as an
int.
|
|
synchronized
void
|
reset()
Reset this InputStream to position 0.
|
|
synchronized
long
|
skip(long n)
Skips count number of characters in this InputStream.
|
|
[Expand]
Inherited Methods |
From class java.io.InputStream
|
From class java.lang.Object
|
Object
|
clone()
Returns a new instance of the same class as the receiver, whose slots
have been filled in with the values in the slots of the receiver.
|
|
boolean
|
equals(Object o)
Compares the argument to the receiver, and returns true if they represent
the same object using a class specific comparison.
|
|
void
|
finalize()
Called by the virtual machine when there are no longer any (non-weak)
references to the receiver.
|
|
final
Class<? extends Object>
|
getClass()
Returns the unique instance of java.lang.Class which represents the class
of the receiver.
|
|
int
|
hashCode()
Returns an integer hash code for the receiver.
|
|
final
void
|
notify()
Causes one thread which is wait ing on the receiver to be
made ready to run.
|
|
final
void
|
notifyAll()
Causes all threads which are wait ing on the receiver to
be made ready to run.
|
|
String
|
toString()
Returns a string containing a concise, human-readable description of the
receiver.
|
|
final
void
|
wait(long time, int frac)
Causes the thread which sent this message to be made not ready to run
either pending some change in the receiver (as indicated by
notify or notifyAll) or the expiration of
the timeout.
|
|
final
void
|
wait(long time)
Causes the thread which sent this message to be made not ready to run
either pending some change in the receiver (as indicated by
notify or notifyAll) or the expiration of
the timeout.
|
|
final
void
|
wait()
Causes the thread which sent this message to be made not ready to run
pending some change in the receiver (as indicated by notify
or notifyAll).
|
|
From interface java.io.Closeable
|
abstract
void
|
close()
Close the object and release any system resources it holds.
|
|
Fields
protected
String
buffer
The String containing the data to read.
protected
int
count
The total number of characters inside the buffer.
protected
int
pos
The current position within the String buffer.
Public Constructors
public
StringBufferInputStream
(String str)
Constructs a new StringBufferInputStream on the String str.
Parameters
| str
| the String to read characters from.
|
Public Methods
public
synchronized
int
available
()
Returns an int representing then number of characters that are available
to read.
Returns
- the number of characters available.
public
synchronized
int
read
(byte[] b, int offset, int length)
Reads at most length bytes from this InputStream and
stores them in byte array b starting at
offset. Answer the number of bytes actually read or -1 if
no bytes were read and end of stream was encountered.
Parameters
| b
| the byte array in which to store the read bytes. |
| offset
| the offset in b to store the read bytes. |
| length
| the maximum number of bytes to store in b. |
Returns
- the number of bytes actually read or -1 if end of stream.
public
synchronized
int
read
()
Reads a single byte from this InputStream and returns the result as an
int. The low-order byte is returned or -1 of the end of stream was
encountered.
Returns
- the byte read or -1 if end of stream.
public
synchronized
void
reset
()
Reset this InputStream to position 0. Reads/Skips will now take place
from this position.
public
synchronized
long
skip
(long n)
Skips count number of characters in this InputStream.
Subsequent read()'s will not return these characters
unless reset() is used.
Parameters
| n
| the number of characters to skip. |
Returns
- the number of characters actually skipped.