java.lang.IndexOutOfBoundsException
        at java.io.BufferedInputStream.read(BufferedInputStream.java:272)
        at fileDivision.main(fileDivision.java:21)

解决方案 »

  1.   

    给你一个代码片断,自己看看吧
            try {
                final int blockIndex = par.getBlockIndex();
                File file = new File(par.getFileFullPath());
                if (!file.exists()) {
                    result.setExsit(false);
                    return result;
                }
                bis = new BufferedInputStream(new FileInputStream(file));
                result.setExsit(true);
                long startPos = blockIndex * BLOCK_SIZE;
                bis.skip(blockIndex * BLOCK_SIZE - BLOCK_SIZE);
                byte[] bytes = new byte[BLOCK_SIZE];
                final int readed = bis.read(bytes, 0, BLOCK_SIZE);
                byte[] returnBytes = null;            if (readed < 0) {
                    returnBytes = new byte[0];
                    result.setFinished(true);
                } else if (readed < BLOCK_SIZE) {
                    returnBytes = new byte[readed];
                    System.arraycopy(bytes, 0, returnBytes, 0, readed);
                    result.setFinished(true);
                } else {
                    returnBytes = bytes;
                    result.setFinished(false);
                }
      

  2.   

    www.javaresearch.org
    上边有个winrar java版,是开源的,应该有你想要的功能,可以参考一下。
      

  3.   

    程序逻辑有问题
    你看一下for循环