gnu.mapping

Class CharArrayOutPort

public class CharArrayOutPort extends OutPort

Similar to CharArrayWriter.
Constructor Summary
CharArrayOutPort()
Method Summary
voidclose()
Do nothing.
protected booleancloseOnExit()
No point in registering this port with a WriterManager.
intlength()
voidreset()
voidsetLength(int length)
char[]toCharArray()
Returns the written data as a freshly copied {@code char} array.
StringtoString()
Returns the written data as a new {@code String}.
StringtoSubString(int beginIndex, int endIndex)
Returns a substring of the written data as a new {@code String}.
StringtoSubString(int beginIndex)
Returns a substring of the written data as a new {@code String}.
voidwriteTo(Consumer out)
voidwriteTo(int start, int count, Consumer out)

Constructor Detail

CharArrayOutPort

public CharArrayOutPort()

Method Detail

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.

closeOnExit

protected boolean closeOnExit()
No point in registering this port with a WriterManager.

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 {@code char} array.

toString

public String toString()
Returns the written data as a new {@code String}.

toSubString

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

toSubString

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

writeTo

public void writeTo(Consumer out)

writeTo

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