/** * INTERNAL */ @Override public void close() { IOUtils.closeSilently(input); input = null; IOUtils.closeSilently(output); output = null; }
/** * Close input and output streams. */ void closeIO() { IOUtils.closeSilently(out); out = null; IOUtils.closeSilently(in); in = null; if (store != null) { store.closeSilently(); store = null; } }
@Override public void run() { try { input = new BufferedInputStream(socket.getInputStream()); output = new BufferedOutputStream(socket.getOutputStream()); while (!stop) { if (!process()) { break; } } } catch (Exception e) { DbException.traceThrowable(e); } IOUtils.closeSilently(output); IOUtils.closeSilently(input); try { socket.close(); } catch (IOException e) { // ignore } finally { server.remove(this); } }
private void process(Connection conn, String fileName, boolean continueOnError, Charset charset) throws SQLException, IOException { InputStream in = FileUtils.newInputStream(fileName); String path = FileUtils.getParent(fileName); try { in = new BufferedInputStream(in, Constants.IO_BUFFER_SIZE); Reader reader = new InputStreamReader(in, charset); process(conn, continueOnError, path, reader, charset); } finally { IOUtils.closeSilently(in); } }
/** * Copy all data from the input stream to the output stream and close both * streams. Exceptions while closing are ignored. * * @param in the input stream * @param out the output stream * @return the number of bytes copied */ public static long copyAndClose(InputStream in, OutputStream out) throws IOException { try { long len = copyAndCloseInput(in, out); out.close(); return len; } catch (Exception e) { throw DbException.convertToIOException(e); } finally { closeSilently(out); } }
IOUtils.closeSilently(prepInsertRow); IOUtils.closeSilently(prepInsertMap);
IOUtils.closeSilently(prepSelectRow); IOUtils.closeSilently(prepDeleteMap); IOUtils.closeSilently(prepDeleteRow);
/** * Copy all data from the input stream to the output stream and close the * input stream. Exceptions while closing are ignored. * * @param in the input stream * @param out the output stream (null if writing is not required) * @return the number of bytes copied */ public static long copyAndCloseInput(InputStream in, OutputStream out) throws IOException { try { return copy(in, out); } catch (Exception e) { throw DbException.convertToIOException(e); } finally { closeSilently(in); } }
o.close(); } finally { IOUtils.closeSilently(o); throw DbException.convertIOException(e, zipFileName); } finally { IOUtils.closeSilently(in);
throw DbException.convertIOException(e, null); } finally { IOUtils.closeSilently(out); testing = false;
} finally { if (useOwnConnection) { IOUtils.closeSilently(prepInsertWord);
IOUtils.closeSilently(in); throw DbException.convertIOException(e, zipFileName); } finally { IOUtils.closeSilently(fileOut);
private void dumpLob(String fileName, boolean lobCompression) { OutputStream fileOut = null; FileStore fileStore = null; long size = 0; String n = fileName + (lobCompression ? ".comp" : "") + ".txt"; InputStream in = null; try { fileOut = FileUtils.newOutputStream(n, false); fileStore = FileStore.open(null, fileName, "r"); fileStore.init(); in = new FileStoreInputStream(fileStore, this, lobCompression, false); size = IOUtils.copy(in, fileOut); } catch (Throwable e) { // this is usually not a problem, because we try both compressed and // uncompressed } finally { IOUtils.closeSilently(fileOut); IOUtils.closeSilently(in); closeSilently(fileStore); } if (size == 0) { try { FileUtils.delete(n); } catch (Exception e) { traceError(n, e); } } }
writeError(writer, e); } finally { IOUtils.closeSilently(writer); closeSilently(store);
IOUtils.closeSilently(in);
/** * INTERNAL */ public void close() { IOUtils.closeSilently(reader); reader = null; IOUtils.closeSilently(writer); writer = null; }
/** * INTERNAL */ @Override public void close() { IOUtils.closeSilently(input); input = null; IOUtils.closeSilently(output); output = null; }
protected void closeIO() { IOUtils.closeSilently(out); out = null; IOUtils.closeSilently(in); in = null; if (store != null) { store.closeSilently(); store = null; } }
public static long copyAndCloseInput(InputStream in, OutputStream out) throws IOException { try { return copy(in, out); } finally { closeSilently(in); } }
private void process(Connection conn, String fileName, boolean continueOnError, String charsetName) throws SQLException, IOException { InputStream in = FileUtils.openFileInputStream(fileName); String path = FileUtils.getParent(fileName); try { in = new BufferedInputStream(in, Constants.IO_BUFFER_SIZE); Reader reader = new InputStreamReader(in, charsetName); process(conn, continueOnError, path, reader, charsetName); } finally { IOUtils.closeSilently(in); } }