📜  Java.io.BufferedWriter类

📅  最后修改于: 2020-11-15 02:38:50             🧑  作者: Mango


介绍

Java.io.BufferedWriter类将文本写入字符输出流,缓冲字符以便有效地写入单个字符,数组和字符串。以下是有关BufferedWriter的要点-

  • 可以指定缓冲区大小,也可以使用默认大小。

  • Writer立即将其输出发送到基础字符或字节流。

类声明

以下是Java.io.BufferedWriter类的声明-

public class BufferedWriter
   extends Writer

领域

以下是Java.io.BufferedWriter类的字段-

  • protected Object lock-这是用于同步此流上的操作的对象。

类的构造函数

Sr.No. Constructor & Description
1

BufferedWriter(Writer out)

This creates a buffered character-output stream that uses a default-sized output buffer.

2

BufferedWriter(Writer out, int sz)

This creates a new buffered character-output stream that uses an output buffer of the given size.

类方法

Sr.No. Method & Description
1 void close()

This method closes the stream, flushing it first.

2 void flush()

This method flushes the stream.

3 void newLine()

This method writes a line separator.

4 void write(char[] cbuf, int off, int len)

This method writes a portion of an array of characters.

5 void write(int c)

This method writes a single character.

6 void write(String s, int off, int len)

This method writes a portion of a String.

方法继承

此类从以下类继承方法-

  • Java.io.作家
  • Java对象