Examples of ORecordBytes


Examples of com.orientechnologies.orient.core.record.impl.ORecordBytes

      out.printf("Flat - record id: %s   v.%d\n", rec.getIdentity().toString(), rec.getVersion());
      out.println("--------------------------------------------------");
      out.print(rec.value());

    } else if (currentRecord instanceof ORecordBytes) {
      ORecordBytes rec = (ORecordBytes) currentRecord;
      out.println("--------------------------------------------------");
      out.printf("Flat - record id: %s   v.%d\n", rec.getIdentity().toString(), rec.getVersion());
      out.println("--------------------------------------------------");
      byte[] value = rec.toStream();
      for (int i = 0; i < Array.getLength(value); ++i) {
        out.printf("%03d", Array.getByte(value, i));
      }

    } else {
View Full Code Here

Examples of com.orientechnologies.orient.core.record.impl.ORecordBytes

      out.printf("Flat - record id: %s   v.%d\n", rec.getIdentity().toString(), rec.getVersion());
      out.println("--------------------------------------------------");
      out.print(rec.value());

    } else if (currentRecord instanceof ORecordBytes) {
      ORecordBytes rec = (ORecordBytes) currentRecord;
      out.println("--------------------------------------------------");
      out.printf("Flat - record id: %s   v.%d\n", rec.getIdentity().toString(), rec.getVersion());
      out.println("--------------------------------------------------");
      byte[] value = rec.toStream();
      for (int i = 0; i < Array.getLength(value); ++i) {
        out.printf("%03d", Array.getByte(value, i));
      }

    } else {
View Full Code Here

Examples of com.orientechnologies.orient.core.record.impl.ORecordBytes

  @Test
  public void testBasicCreate() {
    database.open("admin", "admin");

    ORecordBytes record = new ORecordBytes(database, "This is a test".getBytes());
    record.save();
    rid = record.getIdentity();

    database.close();
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.record.impl.ORecordBytes

  @Test(dependsOnMethods = "testBasicCreate")
  public void testBasicRead() {
    database.open("admin", "admin");

    ORecordBytes record = database.load(rid);

    Assert.assertEquals("This is a test", new String(record.toStream()));

    database.close();
  }
View Full Code Here

Examples of com.orientechnologies.orient.core.record.impl.ORecordBytes

  @Test(dependsOnMethods = "testBasicRead")
  public void testMixedCreate() {
    database.open("admin", "admin");

    ODocument doc = new ODocument(database);
    doc.field("binary", new ORecordBytes(database, "Binary data".getBytes()));

    doc.save();
    rid = doc.getIdentity();

    database.close();
View Full Code Here

Examples of com.orientechnologies.orient.core.record.impl.ORecordBytes

      for (int i = 0; i < count; i++) {
        doc.reset();
        doc.setClassName("Chunk");
        doc.field("hash", "key" + Integer.toString(i));
        doc.field("binary", new ORecordBytes(database, data));
        doc.save();

        ORID rid = doc.getIdentity();
        if (i % 100 == 0)
          System.out.println("ORID=" + rid);
View Full Code Here

Examples of com.orientechnologies.orient.core.record.impl.ORecordBytes

        Assert.assertTrue(result.size() > 0);

        if (result != null && result.size() > 0) {
          ODocument doc = (ODocument) result.iterator().next();
          System.out.println("loaded " + i + "(" + rand + "), binary record: " + doc.field("binary", ORID.class));
          ORecordBytes record = doc.field("binary");
          Assert.assertNotNull(record);
          if (record != null) {
            byte[] data = record.toStream();
            Assert.assertTrue(data.length == size);
          }
        } else {
          System.out.println("key not found " + rand);
        }
View Full Code Here

Examples of com.orientechnologies.orient.core.record.impl.ORecordBytes

        final ORecordStringable record = (ORecordStringable) iRecord;
        json.writeAttribute(indentLevel + 1, true, "value", record.value());

      } else if (iRecord instanceof ORecordBytes) {
        // BYTES
        final ORecordBytes record = (ORecordBytes) iRecord;
        json.writeAttribute(indentLevel + 1, true, "value", OBase64Utils.encodeBytes(record.toStream()));
      } else

        throw new OSerializationException("Error on marshalling record of type '" + iRecord.getClass()
            + "' to JSON. The record type can't be exported to JSON");
View Full Code Here

Examples of com.orientechnologies.orient.core.record.impl.ORecordBytes

      }

      fileDocument = null;
    } else {
      if (fileRID != null) {
        ORecordBytes file = new ORecordBytes(database, fileRID);
        database.delete(file);
      }
      sendTextContent(iRequest, OHttpUtils.STATUS_INVALIDMETHOD_CODE, "Document template cannot be null", null,
          OHttpUtils.CONTENT_TEXT_PLAIN, "Document template cannot be null");
    }
View Full Code Here

Examples of com.orientechnologies.orient.core.record.impl.ORecordBytes

    final String rid = urlParts[2];

    iRequest.data.commandInfo = "Download";
    iRequest.data.commandDetail = rid;

    final ORecordBytes response;

    try {

      response = db.load(new ORecordId(rid));
      if (response != null) {
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.