圖像檔分散拆件問題??? |
尚未結案
|
Zonda
一般會員 發表:23 回覆:40 積分:12 註冊:2003-10-30 發送簡訊給我 |
請教當我用Datagram socket去Send圖像檔時,每當遇到100-200KB的圖像檔時
住住耍要分散去幾個ByteArray存傳,每當我存入第一個ByteArray時就發生問題
如:ArrayIndexOutOfBoundsException
以下就是發生問題的地方:
Global Variable:
private byte[] ba = new byte[1000];
private byte[] ba2 = new byte[1000];
private byte[] ba3 = new byte[50000];
private byte[] ba4 = new byte[50000];
private byte[] ba5 = new byte[30000];
private byte[] Imgba = new byte[200000]; public synchronized int ReadToByte(FileInputStream fis, DataBufferByte dbb, String filepath) {
int num2 = 0;
int num3 = 0;
int addnum2 = 0;
try {
fis = new FileInputStream(new File(filepath));
num2 = fis.read(Imgba, 0, Imgba.length);
dbb = new DataBufferByte(Imgba, Imgba.length);
------> for (int i = 0;i <= ba3.length; i) {
ba3 = dbb.getData(i);
}
for (int i = 1;i < ba4.length; i) {
ba4 = dbb.getData(ba3.length i);
}
fis.close();
return(num2);
} catch (FileNotFoundException fe) {
printMess("File cannot be open for reading ERROR!!!");
fe.printStackTrace();
} catch (IOException ioe) {
printMess("IOException, file cannot be read to byte ERROR!!!");
ioe.printStackTrace();
}
return(-1);
}
|
neoart
版主 發表:22 回覆:582 積分:425 註冊:2003-05-09 發送簡訊給我 |
|
Zonda
一般會員 發表:23 回覆:40 積分:12 註冊:2003-10-30 發送簡訊給我 |
|
Zonda
一般會員 發表:23 回覆:40 積分:12 註冊:2003-10-30 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |