public class ContentWriter extends Object implements Closeable, Flushable
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
boolean |
equals(Object obj) |
void |
flush() |
int |
hashCode() |
void |
safeClose()
Safely close this writer logging any errors that occur during closing.
|
void |
setAutoFlush(boolean autoFlush)
Set the value to
false if the buffer should not automatically flush on each write. |
String |
toString() |
void |
write(Object value)
Writes the value of the object to the file.
|
void |
write(String value)
Writes the value to the file.
|
public void write(Object value)
value - the value to write, cannot be nullUncheckedIOException - if an error occurs writing the datapublic void write(String value)
value - the value to write, cannot be null or an empty string.UncheckedIOException - if an error occurs writing the datapublic void setAutoFlush(boolean autoFlush)
false if the buffer should not automatically flush on each write.
Defaults to true.
autoFlush - true to flush on each write, otherwise false to flush
when the buffer determines it should be flushedpublic void close()
close in interface Closeableclose in interface AutoCloseablepublic void safeClose()
Copyright © 2025 JBoss by Red Hat. All rights reserved.