±Û¾´ÀÌ :¼ÛÄ¡ºÀ 1999³â 10¿ù 12ÀÏ 11:05:11
ÈÀÏÀ» ¿ÀÇÂÇÏ°í ±× ÈÀÏÀÇ ³»¿ëÀ» FileInputStreamÀ¸·Î ¹Þ¾Æ¼ byte ¹è¿·Î ¿Å±â·Á°í Çϴµ¥ ÇÁ·Î±×·¥ ¿¡·¯°¡ ¹ß»ýÇÕ´Ï´Ù. ¿¡·¯ ³»¿ë°ú ¼Ò½º ÄÚµå´Â ´ÙÀ½°ú °°½À´Ï´Ù.
¿¡·¯ :
java.io.StreamCorruptException: InputStream does not contain a serialized object Stacktrace is disabled. Set JAVA_COMPCMD=STA(CKTRACE) to enable.
ÇÁ·Î±×·¥ ¼Ò½º :
byte b1[];
byte tmp;
com.sun.java.swing.JFrame frame1 = new com.sun.java.swing.JFrame();
FileDialog fdRead = new FileDialog(frame1);
fdRead.setMode(FileDialog.LOAD);
fdRead.setVisible(true);
String theFile = fdRead.getFile();
String theFileDir = fdRead.getDirectory();
if ( (theFile == null) || (theFile.equals(""))) {
//no selected file so abort
return;
}
File file=new File(theFileDir, theFile);
b1 = new byte[(int) file.length()];
FileInputStream istream = new FileInputStream(file); --------> ¿¡·¯ ¹ß»ý ¹®Àå
ObjectInputStream in = new ObjectInputStream(istream);
for (int i=0; ((tmp = in.readByte())!=0); i++) b1[i]=tmp;
Á¦ ¼öÁØÀ¸·Î´Â µµÀúÈ÷ ¹«¾ù¶§¹®¿¡ ¿¡·¯°¡ ¹ß»ýÇÏ´ÂÁö ¸ð¸£°Ú½À´Ï´Ù.
ÀÚ¹Ù Àü¹®°¡´ÔÀÇ Áöµµ¸¦ ºÎŹµå¸³´Ï´Ù.