public void nextFile() { closeCurrent(); try { current = provider.openNext(); } catch (IOException ex) { throw new RuntimeException(ex); } }
@Override public FileOutput open(TaskSource taskSource, final FileOutput fileOutput) { final PluginTask task = taskSource.loadTask(PluginTask.class); final FileOutputOutputStream output = new FileOutputOutputStream(fileOutput, task.getBufferAllocator(), FileOutputOutputStream.CloseMode.FLUSH); return new OutputStreamFileOutput(new OutputStreamFileOutput.Provider() { public OutputStream openNext() throws IOException { output.nextFile(); return new BZip2CompressorOutputStream(output, task.getLevel()); } public void finish() throws IOException { fileOutput.finish(); } public void close() throws IOException { fileOutput.close(); } }); } }
@Override public FileOutput open(TaskSource taskSource, final FileOutput fileOutput) { final PluginTask task = taskSource.loadTask(PluginTask.class); final FileOutputOutputStream output = new FileOutputOutputStream(fileOutput, task.getBufferAllocator(), FileOutputOutputStream.CloseMode.FLUSH); return new OutputStreamFileOutput(new OutputStreamFileOutput.Provider() { public OutputStream openNext() throws IOException { output.nextFile(); return new GZIPOutputStream(output) { { this.def.setLevel(task.getLevel()); } }; } public void finish() throws IOException { fileOutput.finish(); } public void close() throws IOException { fileOutput.close(); } }); } }
public void finish() { closeCurrent(); try { provider.finish(); } catch (IOException ex) { throw new RuntimeException(ex); } }
public void close() { try { closeCurrent(); } finally { try { provider.close(); } catch (IOException ex) { throw new RuntimeException(ex); } } }