Agree with people saying that youd should refactor your class and split it into smaller ones. Each doing small simple job. Regarding your code, I feel that this is not due to huge files you're trying to read. Probably you're doing something wrong when reading them. Let me look closer to code and stack trace
Your method private byte[] readFile(String files) is wrong. You're not reading the file here, but filling your ByteArrayOutputStrem with initial data (i.e. with zeroes) from byte[] buffer many many times, exactly bytes in file times. here's wrong part : line 1108: for (int len; (len = fis.read()) != -1;) { bos.write(buffer, 0, len); }
Обсуждают сегодня