0
이 코드를 사용하여 파일에 쓰려고하는데 IndexOutOfBoundException
이 표시됩니다.파일에 쓰는 중 IndexOutOfBoundException
InputStream is = res.openStream();
FileOutputStream fos = new FileOutputStream(file);
byte[] array = new byte[1024];
for(int i = is.read(array); i != 1; i=is.read(array)) {
fos.write(array, 0, i);
}
쓸 수있는 바이트 수는 어떻게 확인할 수 있습니까?
당신 내가 1''과 다른 경우에만 루프 휴식합니다. 읽을 것이 없으면'is.read' 메쏘드는 -1을 반환합니다. – Matthias
와우 나는 그것을 어떻게 든 놓쳤다 –
그것은 놓칠 쉬운 보통 보통이다 :) 모두에게 항상 일어난다. – Matthias