@Override public ByteSource apply(InputSupplier<? extends InputStream> input) { return asByteSource(input); } });
@Override public ByteSource apply(InputSupplier<? extends InputStream> input) { return asByteSource(input); } });
@Override public ByteSource apply(InputSupplier<? extends InputStream> input) { return asByteSource(input); } });
@Override public ByteSource apply(InputSupplier<? extends InputStream> input) { return asByteSource(input); } });
/** * Returns true if the supplied input streams contain the same bytes. * * @throws IOException if an I/O error occurs */ public static boolean equal(InputSupplier<? extends InputStream> supplier1, InputSupplier<? extends InputStream> supplier2) throws IOException { return asByteSource(supplier1).contentEquals(asByteSource(supplier2)); }
/** * Returns true if the supplied input streams contain the same bytes. * * @throws IOException if an I/O error occurs */ public static boolean equal(InputSupplier<? extends InputStream> supplier1, InputSupplier<? extends InputStream> supplier2) throws IOException { return asByteSource(supplier1).contentEquals(asByteSource(supplier2)); }
/** * Returns true if the supplied input streams contain the same bytes. * * @throws IOException if an I/O error occurs */ public static boolean equal(InputSupplier<? extends InputStream> supplier1, InputSupplier<? extends InputStream> supplier2) throws IOException { return asByteSource(supplier1).contentEquals(asByteSource(supplier2)); }
/** * Returns true if the supplied input streams contain the same bytes. * * @throws IOException if an I/O error occurs */ public static boolean equal(InputSupplier<? extends InputStream> supplier1, InputSupplier<? extends InputStream> supplier2) throws IOException { return asByteSource(supplier1).contentEquals(asByteSource(supplier2)); }
/** * Returns true if the supplied input streams contain the same bytes. * * @throws IOException if an I/O error occurs * @deprecated Use {@link ByteSource#contentEquals(ByteSource)} instead. This * method is scheduled for removal in Guava 18.0. */ @Deprecated public static boolean equal(InputSupplier<? extends InputStream> supplier1, InputSupplier<? extends InputStream> supplier2) throws IOException { return asByteSource(supplier1).contentEquals(asByteSource(supplier2)); }
/** * Returns the length of a supplied input stream, in bytes. * * @deprecated Use {@link ByteSource#size()} instead. This method is * scheduled for removal in Guava 18.0. */ @Deprecated public static long length( InputSupplier<? extends InputStream> supplier) throws IOException { return asByteSource(supplier).size(); }
/** * Returns a factory that will supply instances of * {@link ByteArrayInputStream} that read from the given byte array. * * @param b the input buffer * @return the factory */ public static InputSupplier<ByteArrayInputStream> newInputStreamSupplier( byte[] b) { return ByteStreams.asInputSupplier(asByteSource(b)); }
/** Returns the length of a supplied input stream, in bytes. */ public static long length( InputSupplier<? extends InputStream> supplier) throws IOException { return asByteSource(supplier).size(); }
/** * Returns the data from a {@link InputStream} factory as a byte array. * * @param supplier the factory * @throws IOException if an I/O error occurs */ public static byte[] toByteArray( InputSupplier<? extends InputStream> supplier) throws IOException { return asByteSource(supplier).read(); }
/** Returns the length of a supplied input stream, in bytes. */ public static long length( InputSupplier<? extends InputStream> supplier) throws IOException { return asByteSource(supplier).size(); }
/** * Returns the data from a {@link InputStream} factory as a byte array. * * @param supplier the factory * @throws IOException if an I/O error occurs */ public static byte[] toByteArray( InputSupplier<? extends InputStream> supplier) throws IOException { return asByteSource(supplier).read(); }
/** * Returns the length of a supplied input stream, in bytes. * * @deprecated Use {@link ByteSource#size()} instead. This method is * scheduled for removal in Guava 18.0. */ @Deprecated public static long length( InputSupplier<? extends InputStream> supplier) throws IOException { return asByteSource(supplier).size(); }
@VisibleForTesting String hashPath(String path) { try { return base64().encode(asByteSource(canonicalPath(path).getBytes(UTF_8)).hash(sha1()).asBytes()); } catch (Exception e) { Throwables.propagateIfPossible(e); throw new HttpException("error creating sigature for path: " + path, e); } }
/** * Copies to a file all bytes from an {@link InputStream} supplied by a * factory. * * @param from the input factory * @param to the destination file * @throws IOException if an I/O error occurs */ public static void copy(InputSupplier<? extends InputStream> from, File to) throws IOException { ByteStreams.asByteSource(from).copyTo(asByteSink(to)); }
/** * Copies to a file all bytes from an {@link InputStream} supplied by a * factory. * * @param from the input factory * @param to the destination file * @throws IOException if an I/O error occurs */ public static void copy(InputSupplier<? extends InputStream> from, File to) throws IOException { ByteStreams.asByteSource(from).copyTo(asByteSink(to)); }
/** * Copies to a file all bytes from an {@link InputStream} supplied by a * factory. * * @param from the input factory * @param to the destination file * @throws IOException if an I/O error occurs */ public static void copy(InputSupplier<? extends InputStream> from, File to) throws IOException { ByteStreams.asByteSource(from).copyTo(asByteSink(to)); }