Examples of openStream()


Examples of org.sonatype.nexus.component.model.Asset.openStream()

    assertThat(encode(injectHasher("SHA512").hash(mockAsset())), is(equalTo(SHA512_HASH)));
  }

  private static Asset mockAsset() throws Exception {
    Asset asset = mock(Asset.class);
    when(asset.openStream()).thenReturn(new ByteArrayInputStream(DATA.getBytes(Charsets.UTF_8)));
    return asset;
  }

  private static String encode(byte[] hash) {
    return BaseEncoding.base16().encode(hash).toLowerCase(Locale.ENGLISH);

Examples of org.sonatype.nexus.component.services.model.TestAsset.openStream()

    TestAsset sourceAsset = testAsset(2);
    sourceAsset.setStreamSupplier(null);
    TestAsset updatedAsset = componentStore.updateAsset(assetId, sourceAsset);

    assertThat(updatedAsset.getDownloadCount(), is(2L));
    assertThat(IOUtils.toString(updatedAsset.openStream()), is(IOUtils.toString(testAsset(1).openStream())));
  }

  // delete

  @Test

Examples of org.w3c.jigsaw.http.Reply.openStream()

      return null;
  // Compress:
  try {
      PipedOutputStream pout = new PipedOutputStream();
      PipedInputStream  pin  = new PipedInputStream(pout);
      new GZIPDataMover(reply.openStream()
            , new GZIPOutputStream(pout));
      reply.addContentEncoding("gzip");
      reply.setContentLength(-1);
      reply.setStream(pin);
  } catch (Exception ex) {
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.