Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.Blob


      coll2.add(new Integer(RandomStringUtils.randomNumeric(5)));
      entity.setProperty("List<Integer>", coll2);

      entity.setProperty("Byte", new Byte(
        RandomStringUtils.randomAlphanumeric(10).getBytes()[0]));
      entity.setProperty("Blob", new Blob(RandomStringUtils
        .randomAlphanumeric(1000)
        .getBytes()));
      entity.setProperty("Text", new Text(RandomStringUtils.randomAlphanumeric(1000)));
      entity.setProperty("ShortBlob", new ShortBlob(RandomStringUtils
        .randomAlphanumeric(500)
View Full Code Here


      entity.setProperty("List<Integer>", coll2);

      // Byte, Blob, Text, ShortBlob, BlobKey
      entity.setProperty("Byte", new Byte(
        RandomStringUtils.randomAlphanumeric(10).getBytes()[0]));
      entity.setProperty("Blob", new Blob(RandomStringUtils
        .randomAlphanumeric(1000)
        .getBytes()));
      entity.setProperty("Text", new Text(RandomStringUtils.randomAlphanumeric(1000)));
      entity.setProperty("ShortBlob", new ShortBlob(RandomStringUtils
        .randomAlphanumeric(500)
View Full Code Here

      RandomStringUtils.randomAlphanumeric(20)));
    entity.setProperty(GbProperty.KEY + "Id", KeyFactory.createKey(RandomStringUtils
      .randomAlphabetic(5), RandomUtils.nextLong()));
    entity.setProperty(GbProperty.KEY + "Name", KeyFactory.createKey(RandomStringUtils
      .randomAlphabetic(5), RandomStringUtils.randomAlphabetic(5)));
    entity.setProperty(GbProperty.BLOB, new Blob(RandomStringUtils
      .randomAlphanumeric(1000)
      .getBytes()));
    entity.setProperty(GbProperty.TEXT, new Text(RandomStringUtils.randomAlphanumeric(1000)));
    entity.setProperty(GbProperty.DATE, new Date(RandomUtils.nextLong()));
    entity.setProperty(GbProperty.LINK, new Link(RandomStringUtils.randomAlphanumeric(30)));
View Full Code Here

     * @param value
     *            the array of bytes
     * @return a blob
     */
    protected Blob bytesToBlob(byte[] value) {
        return value != null ? new Blob(value) : null;
    }
View Full Code Here

     * @param value
     *            the serializable object
     * @return a blob
     */
    protected Blob serializableToBlob(Object value) {
        return value != null ? new Blob(ByteUtil.toByteArray(value)) : null;
    }
View Full Code Here

      is = req.getInputStream();
      fos=new ByteArrayOutputStream();
      IOUtils.copy(is, fos);
      log.info("tama�o : " + fos.size());
      imagen=fos.toByteArray();
      Blob blob=new Blob(imagen);
      ImagenLN imagenln=new ImagenLN(new Date(),blob,Long.valueOf(idUsuario),Long.valueOf(idEquipo));
      NovedadLNDAO.guardarfoto(imagenln);
      res.setStatus(res.SC_OK);
      writer.print("{success: true}");
     
View Full Code Here

    if (segments.size() == 0) {
      GAEFileContent gaeContent = new GAEFileContent();
      gaeContent.setFileId(fileId);
      gaeContent.setSegmentNo(segmentNo);
      gaeContent.setSegmentLength(segmentLength);
      gaeContent.setContent(new Blob(content));
      pm.makePersistent(gaeContent);
    } else {
      GAEFileContent gaeContent = segments.get(0);
      gaeContent.setSegmentLength(segmentLength);
      gaeContent.setContent(new Blob(content));
    }
    pm.close();
    ///String cacheId = gaeFile.getCacheId();
    ///log.info("trying to put byte data to memcache for '" + gaeFile.getName() + "' with id '" + cacheId + "'");
    ///try {
View Full Code Here

    Entity e = new Entity(makeKey(t.filename));
    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    try (ObjectOutputStream oout = new ObjectOutputStream(bout)) {
      oout.writeObject(t.options);
    }
    e.setUnindexedProperty(OPTIONS_PROP, new Blob(bout.toByteArray()));
    e.setUnindexedProperty(CREATION_TIME_PROP, System.currentTimeMillis());
    e.setUnindexedProperty(FILE_LENGTH_PROP, stats.getLength());
    DATASTORE.put(null, e);
  }
View Full Code Here

            memcache.put(id, bytes, expires);

            DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
            Entity entity = new Entity(AC_BASE, id);
            entity.setProperty(PROPERTY_EXPIRES, expire.getTime());
            entity.setProperty(PROPERTY_DATA, new Blob(bytes));
            ds.put(entity);

        } catch (DeadlineExceededException e) {
            getLogger().warning("DeadlineExceeded for " + session.getId());
            sendDeadlineExceededNotification(request, response);
View Full Code Here

                entity = ds.get(key);
            } catch (EntityNotFoundException e) {
                // Ok, we were a bit optimistic; we'll create a new one later
            }
            if (entity != null) {
                Blob blob = (Blob) entity.getProperty(PROPERTY_DATA);
                serializedAC = blob.getBytes();
                // bring it to memcache
                memcache.put(AC_BASE + session.getId(), serializedAC,
                        Expiration.byDeltaSeconds(session
                                .getMaxInactiveInterval()),
                        MemcacheService.SetPolicy.ADD_ONLY_IF_NOT_PRESENT);
View Full Code Here

TOP

Related Classes of com.google.appengine.api.datastore.Blob

Copyright © 2018 www.massapicom. 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.