±Û¾´ÀÌ :±èÇÊÈ£ 1999³â 10¿ù 12ÀÏ 19:05:11
In Reply to: [Re][Re][Áú¹®:±ÞÇÕ´Ï´Ù.]ÈÀÏÀÇ ³»¿ëÀ» byte¹è¿·Î ¿Å±æ¶§ ¿¡·¯ ¹®ÀÇ posted by ¼ÛÄ¡ºÀ on 1999³â 10¿ù 12ÀÏ 15:04:02:
ObjectInputStream ´ë½Å DataInputStream À» »ç¿ëÇÑ °ÍÀÔ´Ï´Ù.
import java.io.*;
public class ByteReadTest {
public static void main(String[] args) {
byte b1[];
int tmp;
if (args.length > 0) {
try {
File file = new File(args[0]);
b1 = new byte[(int) file.length()];
FileInputStream istream = new FileInputStream(file);
DataInputStream in = new DataInputStream(istream);
for (int i=0; i < b1.length; i++)
b1[i] = (byte) in.read();
in.close();
for (int i=0; i < b1.length; i++)
System.out.print(b1[i] + ", ");
System.out.println();
}
catch (FileNotFoundException ex) {
System.out.println("Warning: The file " + args[0] + " is not found.");
}
catch (IOException ex) {
System.out.println("Warning: IOException");
ex.printStackTrace();
}
}
}
}