Code example for InputSupplier

Methods: getInput

0
      oneHundredOneConstitutions = getTestDataSupplier();
      oneHundredOneConstitutionsMD5 = md5Supplier(oneHundredOneConstitutions);
   } 
 
   protected static byte[] md5Supplier(InputSupplier<InputStream> supplier) throws IOException {
      return asByteSource(supplier.getInput()).hash(md5()).asBytes();
   } 
 
   @SuppressWarnings("unchecked") 
   public static InputSupplier<InputStream> getTestDataSupplier() throws IOException {
      byte[] oneConstitution = ByteStreams.toByteArray(new GZIPInputStream(BaseJettyTest.class
               .getResourceAsStream("/const.txt.gz")));
      InputSupplier<ByteArrayInputStream> constitutionSupplier = ByteStreams.newInputStreamSupplier(oneConstitution);
 
      InputSupplier<InputStream> temp = ByteStreams.join(constitutionSupplier);
 
      for (int i = 0; i < 100; i++) {
         temp = ByteStreams.join(temp, constitutionSupplier);
      } 
      oneHundredOneConstitutionsLength = oneConstitution.length * 101l;
Experience pair programming with AI  Get Codota for Java