/** * if we created the stream, then it is already consumed on close. */ @Override public void release() { closeQuietly(content); }
/** * if we created the stream, then it is already consumed on close. */ @Override public void release() { closeQuietly(closer); } }
/** * if we created the stream, then it is already consumed on close. */ @Override public void release() { closeQuietly(closer); } }
/** * {@inheritDoc} */ @Override public void close() { closeQuietly(closer); }
/** * closes resources associated with this channel. */ @Override public void close() throws IOException { Closeables2.closeQuietly(input); Closeables2.closeQuietly(output); Closeables2.closeQuietly(error); closer.close(); } }
/** * closes resources associated with this channel. */ @Override public void close() throws IOException { Closeables2.closeQuietly(input); Closeables2.closeQuietly(output); Closeables2.closeQuietly(error); closer.close(); } }
public static byte[] toByteArrayAndClose(InputStream input) throws IOException { checkNotNull(input, "input"); try { return ByteStreams.toByteArray(input); } finally { closeQuietly(input); } } }
public static byte[] toByteArrayAndClose(InputStream input) throws IOException { checkNotNull(input, "input"); try { return ByteStreams.toByteArray(input); } finally { closeQuietly(input); } } }
@Override public void clear() { if (inputStream != null) Closeables2.closeQuietly(inputStream); if (errStream != null) Closeables2.closeQuietly(errStream); if (executor != null) executor.disconnect(); }
public static String toStringAndClose(InputStream input) throws IOException { checkNotNull(input, "input"); try { return CharStreams.toString(new InputStreamReader(input, Charsets.UTF_8)); } finally { closeQuietly(input); } }
private static String readVersionPropertyFromClasspath(ClassLoader resourceLoader) { Properties versionProperties = new Properties(); InputStream is = checkNotNull(resourceLoader.getResourceAsStream(VERSION_RESOURCE_FILE), VERSION_RESOURCE_FILE); try { versionProperties.load(is); } catch (IOException exception) { throw new IllegalStateException(format("Unable to load version resource file '%s'", VERSION_RESOURCE_FILE), exception); } finally { closeQuietly(is); } return checkNotNull(versionProperties.getProperty(VERSION_PROPERTY_NAME), VERSION_PROPERTY_NAME); }
private static String readVersionPropertyFromClasspath(ClassLoader resourceLoader) { Properties versionProperties = new Properties(); InputStream is = checkNotNull(resourceLoader.getResourceAsStream(VERSION_RESOURCE_FILE), VERSION_RESOURCE_FILE); try { versionProperties.load(is); } catch (IOException exception) { throw new IllegalStateException(format("Unable to load version resource file '%s'", VERSION_RESOURCE_FILE), exception); } finally { closeQuietly(is); } return checkNotNull(versionProperties.getProperty(VERSION_PROPERTY_NAME), VERSION_PROPERTY_NAME); }
@Override public void clear() throws TransportException, ConnectionException { if (session != null) session.close(); if (sshClientConnection != null) Closeables2.closeQuietly(sshClientConnection); }
@Override public void clear() throws TransportException, ConnectionException { if (session != null) session.close(); if (sshClientConnection != null) Closeables2.closeQuietly(sshClientConnection); }
public T parse(InputStream from) { try { return parse(new InputSource(from)); } finally { closeQuietly(from); } }
public T parse(InputStream from) { try { return parse(new InputSource(from)); } finally { closeQuietly(from); } }
@Override public void clear() { Closeables2.closeQuietly(output); try { if (connection != null) { connection.clear(); } } catch (Throwable e) { Throwables.propagate(e); } }
private void output(final File out) { checkNotNull(out, "output"); InputStream in = null; try { in = new FileInputStream(out); wire(">> ", in); } catch (FileNotFoundException e) { logger.error(e, "Error tapping file: %s", out); } finally { closeQuietly(in); } }
private void output(final File out) { checkNotNull(out, "output"); InputStream in = null; try { in = new FileInputStream(out); wire(">> ", in); } catch (FileNotFoundException e) { logger.error(e, "Error tapping file: %s", out); } finally { closeQuietly(in); } }
public static HashCode hashAndClose(InputStream input, HashFunction hashFunction) throws IOException { checkNotNull(input, "input"); checkNotNull(hashFunction, "hashFunction"); try { HashingInputStream his = new HashingInputStream(hashFunction, input); ByteStreams.copy(his, ByteStreams.nullOutputStream()); return his.hash(); } finally { closeQuietly(input); } }