/** Varargs form of {@link #join(Iterable)}. */ public static InputSupplier<InputStream> join( InputSupplier<? extends InputStream>... suppliers) { return join(Arrays.asList(suppliers)); } }
/** Varargs form of {@link #join(Iterable)}. */ @SuppressWarnings("unchecked") // suppress "possible heap pollution" warning in JDK7 public static InputSupplier<InputStream> join( InputSupplier<? extends InputStream>... suppliers) { return join(Arrays.asList(suppliers)); }
/** Varargs form of {@link #join(Iterable)}. */ @SuppressWarnings("unchecked") // suppress "possible heap pollution" warning in JDK7 public static InputSupplier<InputStream> join( InputSupplier<? extends InputStream>... suppliers) { return join(Arrays.asList(suppliers)); }
/** Varargs form of {@link #join(Iterable)}. */ public static InputSupplier<InputStream> join( InputSupplier<? extends InputStream>... suppliers) { return join(Arrays.asList(suppliers)); } }
/** Varargs form of {@link #join(Iterable)}. */ @SuppressWarnings("unchecked") // suppress "possible heap pollution" warning in JDK7 public static InputSupplier<InputStream> join( InputSupplier<? extends InputStream>... suppliers) { return join(Arrays.asList(suppliers)); }
/** Varargs form of {@link #join(Iterable)}. */ @SuppressWarnings("unchecked") // suppress "possible heap pollution" warning in JDK7 public static InputSupplier<InputStream> join( InputSupplier<? extends InputStream>... suppliers) { return join(Arrays.asList(suppliers)); }
/** Varargs form of {@link #join(Iterable)}. */ public static InputSupplier<InputStream> join( InputSupplier<? extends InputStream>... suppliers) { return join(Arrays.asList(suppliers)); }
/** Varargs form of {@link #join(Iterable)}. */ public static InputSupplier<InputStream> join( InputSupplier<? extends InputStream>... suppliers) { return join(Arrays.asList(suppliers)); } }
/** * Varargs form of {@link #join(Iterable)}. * * @deprecated Use {@link ByteSource#concat(ByteSource[])} instead. This * method is scheduled for removal in Guava 18.0. */ @Deprecated @SuppressWarnings("unchecked") // suppress "possible heap pollution" warning in JDK7 public static InputSupplier<InputStream> join( InputSupplier<? extends InputStream>... suppliers) { return join(Arrays.asList(suppliers)); }
/** * Varargs form of {@link #join(Iterable)}. * * @deprecated Use {@link ByteSource#concat(ByteSource[])} instead. This * method is scheduled for removal in Guava 18.0. */ @Deprecated @SuppressWarnings("unchecked") // suppress "possible heap pollution" warning in JDK7 public static InputSupplier<InputStream> join( InputSupplier<? extends InputStream>... suppliers) { return join(Arrays.asList(suppliers)); }
public InputSupplier<InputStream> combineStreams() { return ByteStreams.join( Iterables.transform( Arrays.asList("meta", "header", "values"), new Function<String,InputSupplier<InputStream>>() { @Override public InputSupplier<InputStream> apply(final String input) { return new InputSupplier<InputStream>() { @Override public InputStream getInput() throws IOException { return ioPeon.makeInputStream(makeFilename(input)); } }; } } ) ); } }
public InputSupplier<InputStream> combineStreams() { return ByteStreams.join( Iterables.transform( Arrays.asList("meta", "header", "values"), new Function<String,InputSupplier<InputStream>>() { @Override public InputSupplier<InputStream> apply(final String input) { return new InputSupplier<InputStream>() { @Override public InputStream getInput() throws IOException { return ioPeon.makeInputStream(makeFilename(input)); } }; } } ) ); } }
@Override public Object getPayload() { // Note that while _bulk requests are made up of JSON, the body as a whole isn't actually valid JSON. final InputStream input; try { input = ByteStreams.join(Iterables.transform(actions, new PayloadFn())).getInput(); } catch (IOException e) { throw new RuntimeException(e); } return input; }
@Override public Object getPayload() { // Note that while _bulk requests are made up of JSON, the body as a whole isn't actually valid JSON. final InputStream input; try { input = ByteStreams.join(Iterables.transform(actions, new PayloadFn())).getInput(); } catch (IOException e) { throw new RuntimeException(e); } return input; }
@SuppressWarnings("unchecked") public static InputSupplier<InputStream> getTestDataSupplier() throws IOException { byte[] oneConstitution = toByteArray(new GZIPInputStream(BaseJettyTest.class.getResourceAsStream("/const.txt.gz"))); InputSupplier<ByteArrayInputStream> constitutionSupplier = newInputStreamSupplier(oneConstitution); InputSupplier<InputStream> temp = join(constitutionSupplier); for (int i = 0; i < 100; i++) { temp = join(temp, constitutionSupplier); } return temp; }
@SuppressWarnings("unchecked") public static InputSupplier<InputStream> getTestDataSupplier() throws IOException { byte[] oneConstitution = toByteArray(new GZIPInputStream(BaseJettyTest.class.getResourceAsStream("/const.txt.gz"))); InputSupplier<ByteArrayInputStream> constitutionSupplier = newInputStreamSupplier(oneConstitution); InputSupplier<InputStream> temp = join(constitutionSupplier); // we have to go beyond 5MB per part for (oneHundredOneConstitutionsLength = oneConstitution.length; oneHundredOneConstitutionsLength < 5 * 1024 * 1024; oneHundredOneConstitutionsLength += oneConstitution.length) { temp = join(temp, constitutionSupplier); } return temp; }
@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; return temp; }
@SuppressWarnings("unchecked") public MultipartForm(String boundary, Iterable<? extends Part> content) { super(content); getContentMetadata().setContentType("multipart/form-data; boundary=" + boundary); getContentMetadata().setContentLength(0l); String boundaryrn = boundary + rn; isRepeatable = true; InputSupplier<? extends InputStream> chain = join(); for (Part part : content) { if (!part.isRepeatable()) isRepeatable = false; getContentMetadata().setContentLength( getContentMetadata().getContentLength() + part.getContentMetadata().getContentLength()); chain = join(chain, addLengthAndReturnHeaders(boundaryrn, part), part, addLengthAndReturnRn()); } chain = join(chain, addLengthAndReturnFooter(boundary)); this.chain = chain; }
@SuppressWarnings("unchecked") public MultipartForm(String boundary, Iterable<? extends Part> content) { super(content); getContentMetadata().setContentType("multipart/form-data; boundary=" + boundary); getContentMetadata().setContentLength(0l); String boundaryrn = boundary + rn; isRepeatable = true; InputSupplier<? extends InputStream> chain = join(); for (Part part : content) { if (!part.isRepeatable()) isRepeatable = false; getContentMetadata().setContentLength( getContentMetadata().getContentLength() + part.getContentMetadata().getContentLength()); chain = join(chain, addLengthAndReturnHeaders(boundaryrn, part), part, addLengthAndReturnRn()); } chain = join(chain, addLengthAndReturnFooter(boundary)); this.chain = chain; }
@SuppressWarnings("unchecked") public MultipartForm(String boundary, Iterable<? extends Part> content) { super(content); getContentMetadata().setContentType("multipart/form-data; boundary=" + boundary); getContentMetadata().setContentLength(0l); String boundaryrn = boundary + rn; isRepeatable = true; InputSupplier<? extends InputStream> chain = join(); for (Part part : content) { if (!part.isRepeatable()) isRepeatable = false; getContentMetadata().setContentLength( getContentMetadata().getContentLength() + part.getContentMetadata().getContentLength()); chain = join(chain, addLengthAndReturnHeaders(boundaryrn, part), part, addLengthAndReturnRn()); } chain = join(chain, addLengthAndReturnFooter(boundary)); this.chain = chain; }