public abstract class AbstractTextFormatWriter extends Object implements Closeable
Modifier | Constructor and Description |
---|---|
protected |
AbstractTextFormatWriter(Writer writer)
Construct a new instance that writes content to the given writer.
|
protected |
AbstractTextFormatWriter(Writer writer,
DoubleFunction<String> doubleFormat)
Construct a new instance that writes content to the given writer and uses the
decimal format instance for creating floating-point string representations.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
DoubleFunction<String> |
getDoubleFormat()
Get the function used to format floating point output.
|
String |
getLineSeparator()
Get the current line separator.
|
protected Writer |
getWriter()
Get the underlying writer instance.
|
void |
setDoubleFormat(DoubleFunction<String> doubleFormat)
Set the function used to format floating point output.
|
void |
setLineSeparator(String lineSeparator)
Set the line separator.
|
protected void |
write(char c)
Write a char value.
|
protected void |
write(double d)
Write a double value formatted using the configured decimal format function.
|
protected void |
write(int n)
Write an integer value.
|
protected void |
write(String str)
Write a string.
|
protected void |
writeNewLine()
Write the configured line separator to the output.
|
protected AbstractTextFormatWriter(Writer writer)
writer
- writer instanceprotected AbstractTextFormatWriter(Writer writer, DoubleFunction<String> doubleFormat)
writer
- writer instancedoubleFormat
- double format functionpublic String getLineSeparator()
public void setLineSeparator(String lineSeparator)
lineSeparator
- the line separator to usepublic DoubleFunction<String> getDoubleFormat()
public void setDoubleFormat(DoubleFunction<String> doubleFormat)
doubleFormat
- double format functionpublic void close()
close
in interface Closeable
close
in interface AutoCloseable
protected void write(double d)
d
- value to writeUncheckedIOException
- if an I/O error occursprotected void write(int n)
n
- value to writeUncheckedIOException
- if an I/O error occursprotected void write(char c)
c
- character to writeUncheckedIOException
- if an I/O error occursprotected void write(String str)
str
- string to writeUncheckedIOException
- if an I/O error occursprotected void writeNewLine()
UncheckedIOException
- if an I/O error occursCopyright © 2016–2021 The Apache Software Foundation. All rights reserved.