ソケット経由でファイル/大量のバイトを書き込んでいます。
しかし、バイトを書いているとしましょう。私はこれをします;
//Connection.data is a dataoutputstream
byte[] a = new byte[filelength];
//load file into the array
//write file
for (int i = 0; i < a.length; i++) {
Connection.data.writeByte(a[i]);
}
受け取るには:
//dat is a datainputstream
byte[] byteA = new byte[bytestoread]
for (int i = 0; i < toread; i++) {
byteA[i] = dat.readByte();
}
着信データをログに記録し、ファイルが 200000 バイトの場合、約 199990 バイトなどで停止するとします。基本的に、バイト [] の任意のサイズで、最後のバイトで停止し、タイムアウトします。わからないことがあれば詳しく説明します。ありがとう。