ewe.io
Class StringStream
java.lang.Object
ewe.util.Errorable
ewe.io.BasicStreamObject
ewe.io.StreamObject
ewe.io.RandomStreamObject
ewe.io.MemoryFile
ewe.io.StringStream
- All Implemented Interfaces:
- BasicRandomAccessStream, BasicStream, FastStream, RandomAccessStream, Stream, Streamable
- public class StringStream
- extends MemoryFile
This is a Stream that you can use if you have a String that you need to
read from as a Stream, or if you need to write to a Stream and then
have the data you wrote converted into a String.
You would probably be better off using a StringWriter instead.
|
Constructor Summary |
StringStream()
Create a new empty StringStream() ready for writing to. |
StringStream(byte[] textData,
int start,
int length,
String mode)
Create a new StringStream() which initially contains text and which can be read from
and/or written to. |
StringStream(String text)
Create a new StringStream() for reading only, initially containing the specified text. |
StringStream(String text,
String mode)
Create a new StringStream() which initially contains text and which can be read from
and/or written to. |
|
Method Summary |
String |
toString()
Return as a String, all the text data that was written into the Stream. |
| Methods inherited from class ewe.io.MemoryFile |
canWrite, createFrom, flushStream, getFilePosition, getLength, isOpen, nonBlockingRead, nonBlockingWrite, quickRead, quickWrite, seek, setStreamLength |
| Methods inherited from class ewe.io.StreamObject |
close, closeStream, doRead, doWrite, flush, nap, nap, read, readAByte, readBytes, readBytes, write, writeAByte, writeBytes, writeBytes |
| Methods inherited from interface ewe.io.Stream |
flush, read, read, read, readBytes, readBytes, toInputStream, toOutputStream, write, write, write, writeBytes, writeBytes |
StringStream
public StringStream()
- Create a new empty StringStream() ready for writing to.
StringStream
public StringStream(String text)
- Create a new StringStream() for reading only, initially containing the specified text.
- Parameters:
text - The text initially stored in the stream.
StringStream
public StringStream(byte[] textData,
int start,
int length,
String mode)
- Create a new StringStream() which initially contains text and which can be read from
and/or written to.
- Parameters:
textData - The initial text, encoded data as bytes.start - The start of the text in textData.length - The number of bytes to use from textData.mode - either "r" or "rw".
StringStream
public StringStream(String text,
String mode)
- Create a new StringStream() which initially contains text and which can be read from
and/or written to.
- Parameters:
text - The initial text in the stream. This will be UTF8 encoded and stored as bytes in the Stream.mode - either "r" or "rw".
toString
public String toString()
- Return as a String, all the text data that was written into the Stream.
- Overrides:
toString in class Object
- Returns:
- a String representing this object.