public void fileActionBuffered(Action action){
        try{
            BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(file));
            byte bytes[] = new byte[optBufferSize];
            int ret;
            do{
                if (inputStream.available() < optBufferSize){
                    byte lastBytes[] = new byte[inputStream.available()];
                    inputStream.read( lastBytes );
                    action.perform(lastBytes);
                    ret = inputStream.read();
                }
                else{
                    ret = inputStream.read( bytes );
                    action.perform(bytes);
                }
                
            }while(ret != -1);
            action.perform(null);
            try{
                inputStream.close();
            }
            catch (IOException e){
                Window.viewer.append("Closing " + file.getName() + "has failed." + Window.newline);
            }
        }
        catch (FileNotFoundException e) {
            Window.viewer.append("File: " + file.getName() + "can not be found." + Window.newline);
        } catch (IOException e) {
            Window.viewer.append(e.getMessage() + Window.newline);
        } 
    }