“BufferedInputStream” Kode Jawaban

Java Buat bufferedInputStream

// Creates a FileInputStream
FileInputStream file = new FileInputStream(String path);

// Creates a BufferedInputStream
BufferedInputStream buffer = new BufferInputStream(file);
SAMER SAEID

BufferedInputStream

try {
    // create a reader
    FileInputStream fis = new FileInputStream(new File("input.dat"));
    BufferedInputStream reader = new BufferedInputStream(fis);

    // read one byte at a time
    int ch;
    while ((ch = reader.read()) != -1) {
        System.out.print((char) ch);
    }

    // close the reader
    reader.close();

} catch (IOException ex) {
    ex.printStackTrace();
}
Wild Wolverine

Java Buat bufferedOutputStream

// Creates a FileOutputStream
FileOutputStream file = new FileOutputStream(String path);

// Creates a BufferedOutputStream
BufferedOutputStream buffer = new BufferOutputStream(file);
SAMER SAEID

Jawaban yang mirip dengan “BufferedInputStream”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya