java.io
Class StringBufferInputStream

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.io.InputStream sample code for java.io.InputStream definition code for java.io.InputStream 
      extended by java.io.StringBufferInputStream
All Implemented Interfaces:
Closeable sample code for java.io.Closeable definition code for java.io.Closeable

Deprecated. This class does not properly convert characters into bytes. As of JDK 1.1, the preferred way to create a stream from a string is via the StringReader class.

@Deprecated
public class StringBufferInputStream
extends InputStream sample code for java.io.InputStream definition code for java.io.InputStream

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.

Since:
JDK1.0
See Also:
ByteArrayInputStream sample code for java.io.ByteArrayInputStream definition code for java.io.ByteArrayInputStream , StringReader sample code for java.io.StringReader definition code for java.io.StringReader

Field Summary
protected  String sample code for java.lang.String definition code for java.lang.String buffer sample code for java.io.StringBufferInputStream.buffer definition code for java.io.StringBufferInputStream.buffer
          Deprecated. The string from which bytes are read.
protected  int count sample code for java.io.StringBufferInputStream.count definition code for java.io.StringBufferInputStream.count
          Deprecated. The number of valid characters in the input stream buffer.
protected  int pos sample code for java.io.StringBufferInputStream.pos definition code for java.io.StringBufferInputStream.pos
          Deprecated. The index of the next character to read from the input stream buffer.
 
Constructor Summary
StringBufferInputStream sample code for java.io.StringBufferInputStream.StringBufferInputStream(java.lang.String) definition code for java.io.StringBufferInputStream.StringBufferInputStream(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  s)
          Deprecated. Creates a string input stream to read data from the specified string.
 
Method Summary
 int available sample code for java.io.StringBufferInputStream.available() definition code for java.io.StringBufferInputStream.available() ()
          Deprecated. Returns the number of bytes that can be read from the input stream without blocking.
 int read sample code for java.io.StringBufferInputStream.read() definition code for java.io.StringBufferInputStream.read() ()
          Deprecated. Reads the next byte of data from this input stream.
 int read sample code for java.io.StringBufferInputStream.read(byte[], int, int) definition code for java.io.StringBufferInputStream.read(byte[], int, int) (byte[] b, int off, int len)
          Deprecated. Reads up to len bytes of data from this input stream into an array of bytes.
 void reset sample code for java.io.StringBufferInputStream.reset() definition code for java.io.StringBufferInputStream.reset() ()
          Deprecated. Resets the input stream to begin reading from the first character of this input stream's underlying buffer.
 long skip sample code for java.io.StringBufferInputStream.skip(long) definition code for java.io.StringBufferInputStream.skip(long) (long n)
          Deprecated. Skips n bytes of input from this input stream.
 
Methods inherited from class java.io.InputStream sample code for java.io.InputStream definition code for java.io.InputStream
close sample code for java.io.InputStream.close() definition code for java.io.InputStream.close() , mark sample code for java.io.InputStream.mark(int) definition code for java.io.InputStream.mark(int) , markSupported sample code for java.io.InputStream.markSupported() definition code for java.io.InputStream.markSupported() , read sample code for java.io.InputStream.read(byte[]) definition code for java.io.InputStream.read(byte[])
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

buffer sample code for java.io.StringBufferInputStream.buffer

protected String sample code for java.lang.String definition code for java.lang.String  buffer
Deprecated. 
The string from which bytes are read.


pos sample code for java.io.StringBufferInputStream.pos

protected int pos
Deprecated. 
The index of the next character to read from the input stream buffer.

See Also:
buffer sample code for java.io.StringBufferInputStream.buffer definition code for java.io.StringBufferInputStream.buffer

count sample code for java.io.StringBufferInputStream.count

protected int count
Deprecated. 
The number of valid characters in the input stream buffer.

See Also:
buffer sample code for java.io.StringBufferInputStream.buffer definition code for java.io.StringBufferInputStream.buffer
Constructor Detail

StringBufferInputStream sample code for java.io.StringBufferInputStream(java.lang.String) definition code for java.io.StringBufferInputStream(java.lang.String)

public StringBufferInputStream(String sample code for java.lang.String definition code for java.lang.String  s)
Deprecated. 
Creates a string input stream to read data from the specified string.

Parameters:
s - the underlying input buffer.
Method Detail

read sample code for java.io.StringBufferInputStream.read() definition code for java.io.StringBufferInputStream.read()

public int read()
Deprecated. 
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.

Specified by:
read sample code for java.io.InputStream.read() definition code for java.io.InputStream.read() in class InputStream sample code for java.io.InputStream definition code for java.io.InputStream
Returns:
the next byte of data, or -1 if the end of the stream is reached.

read sample code for java.io.StringBufferInputStream.read(byte[], int, int) definition code for java.io.StringBufferInputStream.read(byte[], int, int)

public int read(byte[] b,
                int off,
                int len)
Deprecated. 
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.

Overrides:
read sample code for java.io.InputStream.read(byte[], int, int) definition code for java.io.InputStream.read(byte[], int, int) in class InputStream sample code for java.io.InputStream definition code for java.io.InputStream
Parameters:
b - the buffer into which the data is read.
off - the start offset of the data.
len - the maximum number of bytes read.
Returns:
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.
See Also:
InputStream.read() sample code for java.io.InputStream.read() definition code for java.io.InputStream.read()

skip sample code for java.io.StringBufferInputStream.skip(long) definition code for java.io.StringBufferInputStream.skip(long)

public long skip(long n)
Deprecated. 
Skips n bytes of input from this input stream. Fewer bytes might be skipped if the end of the input stream is reached.

Overrides:
skip sample code for java.io.InputStream.skip(long) definition code for java.io.InputStream.skip(long) in class InputStream sample code for java.io.InputStream definition code for java.io.InputStream
Parameters:
n - the number of bytes to be skipped.
Returns:
the actual number of bytes skipped.

available sample code for java.io.StringBufferInputStream.available() definition code for java.io.StringBufferInputStream.available()

public int available()
Deprecated. 
Returns the number of bytes that can be read from the input stream without blocking.

Overrides:
available sample code for java.io.InputStream.available() definition code for java.io.InputStream.available() in class InputStream sample code for java.io.InputStream definition code for java.io.InputStream
Returns:
the value of count - pos, which is the number of bytes remaining to be read from the input buffer.

reset sample code for java.io.StringBufferInputStream.reset() definition code for java.io.StringBufferInputStream.reset()

public void reset()
Deprecated. 
Resets the input stream to begin reading from the first character of this input stream's underlying buffer.

Overrides:
reset sample code for java.io.InputStream.reset() definition code for java.io.InputStream.reset() in class InputStream sample code for java.io.InputStream definition code for java.io.InputStream
See Also:
InputStream.mark(int) sample code for java.io.InputStream.mark(int) definition code for java.io.InputStream.mark(int) , IOException sample code for java.io.IOException definition code for java.io.IOException