
- Java.io - Home
- Java.io - BufferedInputStream
- Java.io - BufferedOutputStream
- Java.io - BufferedReader
- Java.io - BufferedWriter
- Java.io - ByteArrayInputStream
- Java.io - ByteArrayOutputStream
- Java.io - CharArrayReader
- Java.io - CharArrayWriter
- Java.io - Console
- Java.io - DataInputStream
- Java.io - DataOutputStream
- Java.io - File
- Java.io - FileDescriptor
- Java.io - FileInputStream
- Java.io - FileOutputStream
- Java.io - FilePermission
- Java.io - FileReader
- Java.io - FileWriter
- Java.io - FilterInputStream
- Java.io - FilterOutputStream
- Java.io - FilterReader
- Java.io - FilterWriter
- Java.io - InputStream
- Java.io - InputStreamReader
- Java.io - LineNumberInputStream
- Java.io - LineNumberReader
- Java.io - ObjectInputStream
- Java.io - ObjectInputStream.GetField
- Java.io - ObjectOutputStream
- io - ObjectOutputStream.PutField
- Java.io - ObjectStreamClass
- Java.io - ObjectStreamField
- Java.io - OutputStream
- Java.io - OutputStreamWriter
- Java.io - PipedInputStream
- Java.io - PipedOutputStream
- Java.io - PipedReader
- Java.io - PipedWriter
- Java.io - PrintStream
- Java.io - PrintWriter
- Java.io - PushbackInputStream
- Java.io - PushbackReader
- Java.io - RandomAccessFile
- Java.io - Reader
- Java.io - SequenceInputStream
- Java.io - SerializablePermission
- Java.io - StreamTokenizer
- Java.io - StringBufferInputStream
- Java.io - StringReader
- Java.io - StringWriter
- Java.io - Writer
- Java.io package Useful Resources
- Java.io - Discussion
Java.io.Writer Class
Introduction
The Java.io.Writer class is a abstract class for writing to character streams.
Class declaration
Following is the declaration for Java.io.Writer class −
public abstract class Writer extends Object implements Appendable, Closeable, Flushable
Field
Following are the fields for Java.io.Writer class −
protected Object lock − This is the object used to synchronize operations on this stream.
Class constructors
Sr.No. | Constructor & Description |
---|---|
1 |
protected Writer() This creates a new character-stream writer whose critical sections will synchronize on the writer itself. |
2 |
protected Writer(Object lock) This creates a new character-stream writer whose critical sections will synchronize on the given object. |
Class methods
Sr.No. | Method & Description |
---|---|
1 |
Writer append(char c)
This method appends the specified character to this writer. |
2 |
Writer append(CharSequence csq)
This method appends the specified character sequence to this writer. |
3 |
Writer append(CharSequence csq, int start, int end)
This method appends a subsequence of the specified character sequence to this writer. |
4 |
abstract void close()
This method loses the stream, flushing it first. |
5 |
abstract void flush()
This method flushes the stream. |
6 |
void write(char[] cbuf)
This method writes an array of characters. |
7 |
abstract void write(char[] cbuf, int off, int len)
This method writes a portion of an array of characters. |
8 |
void write(int c)
This method writes a single character. |
9 |
void write(String str)
This method writes a string. |
10 |
void write(String str, int off, int len)
This method writes a portion of a string. |
Methods inherited
This class inherits methods from the following classes −
- Java.io.Object