メモ、備忘録、その他雑記を記載します。
ただし、このHPに記載している情報を利用した結果 損失・損害等が発生したとしても筆者は責任を持ちません。
ファイルをバイナリ形式で読み込む処理の雛形
import java.io.*;
System.out.println("Hello");
try
{
int n;
FileInputStream is = new FileInputStream("test.txt");
while ( true )
{
n = is.read();
if ( n == -1 )
{
break;
}
System.out.print(Integer.toHexString( n ) + " ");
}
is.close();
}
catch ( IOException e )
{
System.out.println( e );
}
import java.io.*;
System.out.println("Hello");
try
{
int n;
FileInputStream is = new FileInputStream("test.txt");
while ( true )
{
n = is.read();
if ( n == -1 )
{
break;
}
System.out.print(Integer.toHexString( n ) + " ");
}
is.close();
}
catch ( IOException e )
{
System.out.println( e );
}
PR
コメントを書く