public static byte[] readFullyAndClose(InputStream is) { try { return readFully(is); } finally { Streams.closeQuietly(is); } }
/** * Consumes the input stream entirely and then cleanly closes the connection. * Ignores all exceptions completely, not even logging them! * * Consuming the stream fully is useful for preventing idle TCP connections. * See {@linkplain http://docs.oracle.com/javase/8/docs/technotes/guides/net/http-keepalive.html}. */ public static void consumeAndCloseQuietly(HttpURLConnection connection) { try { Streams.readFully(connection.getInputStream()); } catch (Exception e) {} closeQuietly(connection); }
/** * Consider using {@link #readFullyStringAndClose(InputStream)} instead. */ public static String readFullyString(InputStream is) { return readFully(reader(is)); }
/** * Consumes the input stream entirely and then cleanly closes the connection. * Ignores all exceptions completely, not even logging them! * * Consuming the stream fully is useful for preventing idle TCP connections. * @see <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/net/http-keepalive.html">Persistent Connections</a> */ public static void consumeAndCloseQuietly(HttpURLConnection connection) { try { Streams.readFully(connection.getInputStream()); } catch (Exception e) {} closeQuietly(connection); }
/** @deprecated since 0.10.0 - use {@link #readPem(byte[], String)} instead */ @Deprecated public static KeyPair readPem(InputStream input, final String passphrase) { return readPem(Streams.readFully(input), passphrase); }
public static String readFullyAndClose(Reader is) { try { return readFully(is); } finally { Streams.closeQuietly(is); } }
public DeploymentPlan parseDeploymentPlan(Reader yaml) { return parseDeploymentPlan(Streams.readFully(yaml)); }
/** @deprecated since 0.10.0, use {@link #createAndStartApplication(String)} instead */ @Deprecated protected Entity createAndStartApplication(Reader input) throws Exception { return createAndStartApplication(Streams.readFully(input)); }
/** @deprecated since 0.10.0, use {@link #createStartWaitAndLogApplication(String)} instead */ @Deprecated protected Entity createStartWaitAndLogApplication(Reader input) throws Exception { return createStartWaitAndLogApplication(Streams.readFully(input)); }
/** * @deprecated since 0.11.0, use {@link #createAndStartApplication(String)} instead, * in the same way as {@link AbstractYamlTest}. */ @Deprecated protected Entity createAndStartApplication(Reader input) throws Exception { return createAndStartApplication(Streams.readFully(input)); }
@Override public WinRmToolResponse copyToServer(InputStream source, String destination) { execs.add(new ExecParams(ExecType.COPY_TO_SERVER, ownConstructorProps, ImmutableList.of(new String(Streams.readFully(source))))); return new WinRmToolResponse("", "", 0); }
@Test public void testBasicConfigInheritanceProgrammatic() throws Exception { origApp.config().set(key1, "1"); rebind(); String entityFile = Streams.readFully(new FileReader(new File(mementoDir, "entities/"+origApp.getApplicationId()))); log.info("persisted file with config inheritance programmatic:\n"+entityFile); checkNewAppNonInheritingKey1(newApp); }