질문 : DataInputStream을 사용하여 binary.txt에서 행성 정보를 읽고 표준 출력에 행성 세부 정보를 인쇄하는 프로그램을 작성하십시오.DataInputStream을 사용하여 파일에서 이진 데이터를 읽고 콘솔로 인쇄하는 방법?
그러나 아래 프로그램은 IOException을 발생시킵니다. 나는 그 문제를 알아낼 수 없다. 어떤 도움을 주시면 감사하겠습니다.
import java.io.*;
public class LA4ex2b {
public static void main(String[] args) throws IOException {
DataInputStream input=null;
try
{
input= new DataInputStream(new FileInputStream("C:/Users/user/workspace/LA4ex2a/binary.txt"));
String str;
// read until the string read is null i.e. read till end of file
while ((str = input.readUTF()) != null) {
String token[] = str.split(" "); // tokenizes the string with
// space as a delimeter
for (int i = 0; i <token.length; i++)
{
if (IsDouble.IsaDouble(token[i]))
System.out.print(Double.parseDouble(token[i]));
else
System.out.print(token[i]);
}
}
}
catch (IOException e) {
e.printStackTrace();
}
finally
{
if (input!= null)
input.close();
}
}
}
다음은 이진 파일입니다. MercuryA @ ³ DxxU ~ € D? VenusA ™ I @ Ç £ ÌÌÌÌÍE 4 XQ EarthA¡Õn @ 전자 및 ffffE  { '/ ¶ 마르«- @ @ ºŠ Dàÿ| ¬qÑ JupitorAÇ2/E은 T @ E~Ž'™
user3367892
_question_에서 파일을 게시하는 것이 더하지의 것 . 주석 (또는 u는 실제 파일을 업로드하고 그것에 대한 링크를 제공 할 수있다) – Astrobleme
이 참으로 이진 파일입니다,하지만 당신은 그것의 형식을 모르는 – fge