@Test public void sizeOfBase64DecodedByteSourceIsKnown() throws Exception { byte[] bytes = "hello, world".getBytes(StandardCharsets.US_ASCII); String base64 = BaseEncoding.base64().encode(bytes); ByteSource decodingSource = Hars.base64DecodingSource(base64); Optional<Long> sizeIfKnown = decodingSource.sizeIfKnown().toJavaUtil(); System.out.format("%s size: %s%n", decodingSource, sizeIfKnown); assertTrue("size known", sizeIfKnown.isPresent()); assertEquals("size", bytes.length, sizeIfKnown.get().longValue()); }
static Base64ByteSource base64DecodingSource(String base64Data) { return Base64ByteSource.wrap(base64Data); }
Hars { static Base64ByteSource base64DecodingSource(String base64Data) { return Base64ByteSource.wrap(base64Data); } }
Hars { static Base64ByteSource base64DecodingSource(String base64Data) { return Base64ByteSource.wrap(base64Data); }  }
Hars { static Base64ByteSource base64DecodingSource(String base64Data) { return Base64ByteSource.wrap(base64Data); }  static boolean isBase64Encoded(String contentType, String text, @Nullable String harContentEncoding, @Nullable Long bodySize); @Nullable static ByteSource getRequestPostData(@Nullable List<NameValuePair> params, String contentType, String postDataText, @Nullable Long requestBodySize, @Nullable String postDataComment, Charset defaultCharset); static TypedContent translateResponseContent(              String contentType,
                                                                      @Nullable String text,
                                                                      @Nullable Long bodySize,
                                                                      @Nullable Long contentSize,
                                                                      @Nullable String contentEncodingHeaderValue,
                                                                      @Nullable String harContentEncoding,
                                                                      @SuppressWarnings("unused") @Nullable String comment,
                                                                      Charset defaultCharset); static HarHeader newHarHeader(String name, String value); }
Hars { static Base64ByteSource base64DecodingSource(String base64Data) { return Base64ByteSource.wrap(base64Data); }  static boolean isBase64Encoded(String contentType, String text, @Nullable String harContentEncoding, @Nullable Long bodySize); @Nullable static ByteSource getRequestPostData(@Nullable List<NameValuePair> params, String contentType, String postDataText, @Nullable Long requestBodySize, @Nullable String postDataComment, Charset defaultCharset); static TypedContent translateResponseContent(              String contentType,
                                                                      @Nullable String text,
                                                                      @Nullable Long bodySize,
                                                                      @Nullable Long contentSize,
                                                                      @Nullable String contentEncodingHeaderValue,
                                                                      @Nullable String harContentEncoding,
                                                                      @SuppressWarnings("unused") @Nullable String comment,
                                                                      Charset defaultCharset); static HarHeader newHarHeader(String name, String value);  }