LAPORAN PRAKTIKUM BAHASA PEMROGRAMAN JAVA ASWINA.pdf

January 15, 2019 | Author: aswina seriyantihsb | Category: N/A
Share Embed Donate


Short Description

Download LAPORAN PRAKTIKUM BAHASA PEMROGRAMAN JAVA ASWINA.pdf...

Description

Menggunakan Byte Streaming

Kita akan mengeksplorasi FileInputStream dan FileOutputStream dengan memeriksa program contoh  bernama CopyBytes, yang yang menggunakan byte stream untuk menyalin xanadu.txt, satu byte pada suatu waktu.

import java.io.FileInputStream ja va.io.FileInputStream;; import java.io.FileOutputStream; import java.io.IOException;

 public class CopyBytes {  public static void main(String[] main(String[] args) throws IOException IOException { FileInputStream in = null; FileOutputStream out = null; try { in = new FileInputStream("xanadu.txt"); out = new FileOutputStream("outagain.txt"); FileOutputStream("outagain.txt"); int c;

while ((c = in.read()) != -1) { out.write(c); }

} finally { if (in != null) { in.close(); }

22

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF