【初心者】Java質問・相談スレッド103【大歓迎】
■ このスレッドは過去ログ倉庫に格納されています
0621デフォルトの名無しさん
2007/07/15(日) 12:13:26一度ByteにしてArrayListに格納して、取り出してbyteに変換しています。
もっとスマートな方法(このクラスを使った方が良い等)があれば教えて頂けないでしょうか。
ArrayList byteArray = new ArrayList();
int readByte = 0;
while (readByte != -1) {
readByte = stream.read();
if (readByte != -1) {
byteArray.add(new Byte((byte) readByte));
}
}
Byte[] byteBig = (Byte[]) byteArray.toArray(new Byte[0]);
byte[] byteTmp = new byte[byteBig.length];
for (int i = 0; i < byteBig.length; i++) {
byteTmp[i] = byteBig[i].byteValue();
}
■ このスレッドは過去ログ倉庫に格納されています