gnu.mapping

Class CharArrayOutPort

Implemented Interfaces:
Consumer, Printable

public class CharArrayOutPort
extends OutPort

Similar to CharArrayWriter.

Field Summary

Fields inherited from class gnu.mapping.OutPort

bout, errLocation, objectFormat, outLocation, printReadable, unregisterRef

Constructor Summary

CharArrayOutPort()

Method Summary

void
close()
Do nothing.
protected boolean
closeOnExit()
No point in registering this port with a WriterManager.
int
length()
void
reset()
void
setLength(int length)
char[]
toCharArray()
Returns the written data as a freshly copied char array.
String
toString()
Returns the written data as a new String.
String
toSubString(int beginIndex)
Returns a substring of the written data as a new String.
String
toSubString(int beginIndex, int endIndex)
Returns a substring of the written data as a new String.
void
writeTo(Consumer out)
void
writeTo(int start, int count, Consumer out)

Methods inherited from class gnu.mapping.OutPort

clearBuffer, close, closeLogFile, closeOnExit, echo, endAttribute, endElement, endLogicalBlock, errDefault, freshLine, getColumnNumber, isWordChar, openFile, outDefault, print, print, print, print, print, print, print, runCleanups, setColumnNumber, setErrDefault, setIndentation, setLogFile, setOutDefault, startAttribute, startElement, startLogicalBlock, startLogicalBlock, writeBreak, writeBreakFill, writeBreakLinear, writeSpaceFill, writeSpaceLinear, writeWordEnd, writeWordStart

Methods inherited from class gnu.lists.PrintConsumer

endAttribute, endDocument, endElement, endNumber, ignoring, startAttribute, startDocument, startElement, startNumber, write, writeBoolean, writeDouble, writeFloat, writeInt, writeLong, writeObject

Constructor Details

CharArrayOutPort

public CharArrayOutPort()

Method Details

close

public void close()
Do nothing. This allows access to the buffer after the port is closed. Not clear whether this is a good or bad idea, but it matches ByteArrayOutputStream, CharArrayWriter, and StringWriter.
Overrides:
close in interface OutPort

closeOnExit

protected boolean closeOnExit()
No point in registering this port with a WriterManager.
Overrides:
closeOnExit in interface OutPort

length

public int length()

reset

public void reset()

setLength

public void setLength(int length)

toCharArray

public char[] toCharArray()
Returns the written data as a freshly copied char array.

toString

public String toString()
Returns the written data as a new String.

toSubString

public String toSubString(int beginIndex)
Returns a substring of the written data as a new String. Equivalent to toString().substring(beginIndex) but more efficient.

toSubString

public String toSubString(int beginIndex,
                          int endIndex)
Returns a substring of the written data as a new String. Equivalent to toString().substring(beginIndex, endIndex) but more efficient.

writeTo

public void writeTo(Consumer out)

writeTo

public void writeTo(int start,
                    int count,
                    Consumer out)