@Override public void close() throws IOException { if (_currentInputStream != null) { FileHelper.safeClose(_currentInputStream); } } }
@Override public void close() { FileHelper.safeClose(_reader); _row = null; _rowsRemaining = null; }
@Override public void close() { FileHelper.safeClose(_httpClient); } }
@Override public void close() throws IOException { super.close(); // need to close 'fs' when output stream is closed FileHelper.safeClose(_fs); } }
public static void writeString(Writer writer, String string, String encoding) throws IllegalStateException { try { writer.write(string); } catch (Exception e) { throw new IllegalStateException(e); } finally { safeClose(writer); } }
public AnalysisJobMetadata readMetadata(final File file) { InputStream inputStream = null; try { inputStream = new BufferedInputStream(new FileInputStream(file)); return readMetadata(inputStream); } catch (final FileNotFoundException e) { throw new IllegalArgumentException(e); } finally { FileHelper.safeClose(inputStream); } }
public void removeColumn(final InputColumn<?> column, final boolean updatePanel) { if (!_columns.containsKey(column)) { return; } final JComponent panel = _columns.remove(column); if (panel instanceof Closeable) { FileHelper.safeClose(panel); } if (updatePanel) { updateComponents(); } }
@Override public void run(OutputStream out) throws Exception { final InputStream in = file.getInputStream(); try { FileHelper.copy(in, out); } finally { FileHelper.safeClose(in); } } };
@Override public void close() { super.close(); if (!_closed) { FileHelper.safeClose(_workbook); _closed = true; } } }
public AnalysisJobBuilder create(final File file) { InputStream inputStream = null; try { inputStream = new BufferedInputStream(new FileInputStream(file)); return create(inputStream); } catch (final IOException e) { throw new IllegalArgumentException(e); } finally { FileHelper.safeClose(inputStream); } }
private boolean openNextFile() throws IOException { if (_currentInputStream != null) { FileHelper.safeClose(_currentInputStream); _currentInputStream = null; } _currentFileIndex++; if (_currentFileIndex >= _files.length) { return false; } _currentInputStream = openStream(_currentFileIndex); return true; }
@Override public void run(OutputStream out) throws Exception { final InputStream in = file.getInputStream(); try { FileHelper.copy(in, out); } finally { FileHelper.safeClose(in); } } });
@Override public void run(OutputStream out) throws Exception { InputStream in = getClass().getResourceAsStream("default-conf.xml"); try { FileHelper.copy(in, out); } finally { FileHelper.safeClose(in); } }
@Override public void close() { super.close(); _closed = true; if (_rowPublisher != null) { _rowPublisher.finished(); _rowPublisher = null; } if (_closeables != null) { FileHelper.safeClose((Object[]) _closeables); } }
public AnalysisJobBuilder create(final FileObject file) { InputStream inputStream = null; try { inputStream = file.getContent().getInputStream(); return create(inputStream); } catch (final FileSystemException e) { throw new IllegalArgumentException(e); } finally { FileHelper.safeClose(inputStream); } }
public AnalysisJobMetadata readMetadata(final FileObject file) { InputStream inputStream = null; try { inputStream = file.getContent().getInputStream(); return readMetadata(inputStream); } catch (final FileSystemException e) { throw new IllegalArgumentException(e); } finally { FileHelper.safeClose(inputStream); } }
@Override public final void write(Action<OutputStream> writeCallback) throws ResourceException { final OutputStream out = write(); try { writeCallback.run(out); } catch (Exception e) { throw new ResourceException(this, "Error occurred in write callback", e); } finally { FileHelper.safeClose(out); } }
@Override public final void append(Action<OutputStream> appendCallback) throws ResourceException { final OutputStream out = append(); try { appendCallback.run(out); } catch (Exception e) { throw new ResourceException(this, "Error occurred in append callback", e); } finally { FileHelper.safeClose(out); } }
@Override public final void read(Action<InputStream> readCallback) { final InputStream in = read(); try { readCallback.run(in); } catch (Exception e) { throw new ResourceException(this, "Error occurred in read callback", e); } finally { FileHelper.safeClose(in); } }
@Override public final void write(Action<OutputStream> writeCallback) throws ResourceException { final OutputStream out = write(); try { writeCallback.run(out); } catch (Exception e) { throw new ResourceException(this, "Error occurred in write callback", e); } finally { FileHelper.safeClose(out); } }