Module java.base
Package java.io

Class Writer

java.lang.Object
java.io.Writer
All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable
Direct Known Subclasses:
BufferedWriter, CharArrayWriter, FilterWriter, OutputStreamWriter, PipedWriter, PrintWriter, StringWriter

public abstract class Writer extends Object implements Appendable, Closeable, Flushable
Abstract class for writing to character streams. The only methods that a subclass must implement are write(char[], int, int), flush(), and close(). Most subclasses, however, will override some of the methods defined here in order to provide higher efficiency, additional functionality, or both.
Since:
1.1
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Object
    The object used to synchronize operations on this stream.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates a new character-stream writer whose critical sections will synchronize on the writer itself.
    protected
    Writer(Object lock)
    Creates a new character-stream writer whose critical sections will synchronize on the given object.
  • Method Summary

    Modifier and Type
    Method
    Description
    append(char c)
    Appends the specified character to this writer.