English 中文(简体)
Java.io package classes

Java.io package extras

Java.io package Useful Resources

Selected Reading

Java.io - BufferedOutputStream
  • 时间:2024-12-22

Java.io.BufferedOutputStream Class


Previous Page Next Page  

Introduction

The Java.io.BufferedOutputStream class implements a buffered output stream. By setting up such an output stream, an apppcation can write bytes to the underlying output stream without necessarily causing a call to the underlying system for each byte written.

Class declaration

Following is the declaration for Java.io.BufferedOutputStream class −

pubpc class BufferedOutputStream
   extends FilterOutputStream

Field

Following are the fields for Java.io.BufferedOutputStream class −

    protected byte[] buf − This is the internal buffer where data is stored.

    protected int count − This is the number of vapd bytes in the buffer.

    protected OutputStream out − This is the underlying output stream to be filtered.

Class constructors

Sr.No. Constructor & Description
1

BufferedOutputStream(OutputStream out)

This creates a new buffered output stream to write data to the specified underlying output stream.

2

BufferedOutputStream(OutputStream out, int size)

This creates a new buffered output stream to write data to the specified underlying output stream with the specified buffer size.

Class methods

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

This method flushes this buffered output stream.

2 void write(byte[] b, int off, int len)

This method writes len bytes from the specified byte array starting at offset off to this buffered output stream.

3 void write(int b)

This method writes the specified byte to this buffered output stream.

Methods inherited

This class inherits methods from the following classes −

    Java.io.FilterOutputStream

    Java.io.Object

Advertisements