org.codehaus.plexus.util

Class StringInputStream


public class StringInputStream
extends InputStream

Wraps a String as an InputStream. Note that data will be lost for characters not in ISO Latin 1, as a simple char->byte mapping is assumed.
Author:
Magesh Umasankar

Constructor Summary

StringInputStream(String source)
Composes a stream from a String

Method Summary

void
close()
Closes the Stringreader.
void
mark(int limit)
Marks the read limit of the StringReader.
boolean
markSupported()
int
read()
Reads from the Stringreader, returning the same value.
void
reset()
Resets the StringReader.

Constructor Details

StringInputStream

public StringInputStream(String source)
Composes a stream from a String
Parameters:
source - The string to read from. Must not be null.

Method Details

close

public void close()
            throws IOException
Closes the Stringreader.

mark

public void mark(int limit)
Marks the read limit of the StringReader.
Parameters:
limit - the maximum limit of bytes that can be read before the mark position becomes invalid

markSupported

public boolean markSupported()
See Also:
InputStream.markSupported

read

public int read()
            throws IOException
Reads from the Stringreader, returning the same value. Note that data will be lost for characters not in ISO Latin 1. Clients assuming a return value in the range -1 to 255 may even fail on such input.
Returns:
the value of the next character in the StringReader

reset

public void reset()
            throws IOException
Resets the StringReader.