Package org.codehaus.plexus.util
Class StringInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.codehaus.plexus.util.StringInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class StringInputStream extends java.io.InputStreamDeprecated.As of version 1.5.2 this class should no longer be used because it does not properly handle character encoding. Instead, wrap the output fromString.getBytes(String)into aByteArrayInputStream.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.
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.StringReaderinDeprecated.Source string, stored as a StringReader
-
Constructor Summary
Constructors Constructor Description StringInputStream(java.lang.String source)Deprecated.Composes a stream from a String
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()Deprecated.Closes the Stringreader.voidmark(int limit)Deprecated.Marks the read limit of the StringReader.booleanmarkSupported()Deprecated.intread()Deprecated.Reads from the Stringreader, returning the same value.voidreset()Deprecated.Resets the StringReader.
-
-
-
Method Detail
-
read
public int read() throws java.io.IOExceptionDeprecated.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.- Specified by:
readin classjava.io.InputStream- Returns:
- the value of the next character in the StringReader
- Throws:
java.io.IOException- if the original StringReader fails to be read
-
close
public void close() throws java.io.IOExceptionDeprecated.Closes the Stringreader.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException- if the original StringReader fails to be closed
-
mark
public void mark(int limit)
Deprecated.Marks the read limit of the StringReader.- Overrides:
markin classjava.io.InputStream- Parameters:
limit- the maximum limit of bytes that can be read before the mark position becomes invalid
-
reset
public void reset() throws java.io.IOExceptionDeprecated.Resets the StringReader.- Overrides:
resetin classjava.io.InputStream- Throws:
java.io.IOException- if the StringReader fails to be reset
-
markSupported
public boolean markSupported()
Deprecated.- Overrides:
markSupportedin classjava.io.InputStream- See Also:
InputStream.markSupported()
-
-