Examples of Blob


Examples of org.openstreetmap.osmosis.osmbinary.Fileformat.Blob

    this.listener = listener;
  }


  private byte[] readBlobContent() throws IOException {
    Blob blob = Blob.parseFrom(rawBlob);
    byte[] blobData;

    if (blob.hasRaw()) {
      blobData = blob.getRaw().toByteArray();
    } else if (blob.hasZlibData()) {
      Inflater inflater = new Inflater();
      inflater.setInput(blob.getZlibData().toByteArray());
      blobData = new byte[blob.getRawSize()];
      try {
        inflater.inflate(blobData);
      } catch (DataFormatException e) {
        throw new OsmosisRuntimeException("Unable to decompress PBF blob.", e);
      }
View Full Code Here

Examples of org.sonatype.nexus.blobstore.api.Blob

          {
            @Override
            public void run() throws Exception {
              final byte[] data = new byte[random.nextInt(BLOB_MAX_SIZE_BYTES) + 1];
              random.nextBytes(data);
              final Blob blob = underTest.create(new ByteArrayInputStream(data), TEST_HEADERS);

              blobIdsInTheStore.add(blob.getId());
            }
          }
      );
      testWorkers.add(r);
    }

    for (int i = 0; i < numberOfReaders; i++) {
      TestWorker r = new TestWorker(testWorkers.size(), startingGun, failureHasOccurred, numberOfIterations,
          new TestTask()
          {
            @Override
            public void run() throws Exception {
              final BlobId blobId = blobIdsInTheStore.peek();

              log("Attempting to read " + blobId);

              if (blobId == null) {
                return;
              }

              final Blob blob = underTest.get(blobId);
              if (blob == null) {
                log("Attempted to obtain blob, but it was deleted:" + blobId);
                return;
              }

              try (InputStream inputStream = blob.getInputStream()) {
                readContentAndValidateMetrics(blobId, inputStream, blob.getMetrics());
              }
              catch (BlobStoreException e) {
                // This is normal operation if another thread deletes your blob after you obtain a Blob reference
                log("Concurrent deletion suspected while calling blob.getInputStream().", e);
              }
View Full Code Here

Examples of org.uscxml.Blob

      for (int i = 0; i < origData.length; i++) {
        origData[i] = (byte) i;
      }

      {
        Blob blob = new Blob(origData, "application/octet-stream");
        if (origData.length != blob.getSize())
          throw new RuntimeException("Blob does not match");

        for (int i = 0; i < origData.length; i++) {
          if (origData[i] != blob.getData()[i])
            throw new RuntimeException("Blob mismatch at " + i);
        }
      }

      Data data = new Data(origData, "application/octet-stream");
      Blob blob = data.getBinary();
      System.out.println(blob.getSize());

      byte newData[] = blob.getData();

      if (newData.length != origData.length)
        throw new RuntimeException("Arrays length does not match");
      for (int i = 0; i < origData.length; i++) {
        if (newData[i] != origData[i])
View Full Code Here

Examples of org.waveprotocol.wave.communication.Blob

  /**
   * Serializes a {@link HashedVersion} POJO to a {@link ProtocolHashedVersion}.
   */
  public static ProtocolHashedVersion serialize(HashedVersion hashedVersion) {
    Blob b64Hash = new Blob(Codec.encode(hashedVersion.getHistoryHash()));
    ProtocolHashedVersion version = ProtocolHashedVersionJsoImpl.create();
    version.setVersion(hashedVersion.getVersion());
    version.setHistoryHash(b64Hash);
    return version;
  }
View Full Code Here

Examples of play.modules.morphia.Blob

    private Blob newBlob() {
        return newBlob("test/googlelogo.png");
    }
   
    private Blob newBlob(String path) {
        return new Blob(new File(path), "image/png");
    }
View Full Code Here
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.