Examples of toStream()


Examples of com.orientechnologies.orient.core.record.impl.ORecordBytes.toStream()

  public void testBasicRead() {
    database.open("admin", "admin");

    ORecordBytes record = database.load(rid);

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

    database.close();
  }

  @Test(dependsOnMethods = "testBasicRead")
View Full Code Here

Examples of com.orientechnologies.orient.core.record.impl.ORecordBytes.toStream()

          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.toStream()

        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.toStream()

        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.toStream()

  public void testBasicReadExternal() {
    database.open("admin", "admin");

    ORecordBytes record = database.load(rid);

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

    database.close();
  }

  @Test(dependsOnMethods = "testBasicReadExternal")
View Full Code Here

Examples of com.orientechnologies.orient.core.record.impl.ORecordBytes.toStream()

    } 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.toStream()

    } 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.toStream()

        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.toStream()

  public void fromStream(final ODocument iDocument) {
    initialized = true;
    if (iDocument.containsField("externalPhoto")) {
      // READ THE PHOTO FROM AN EXTERNAL RECORD AS PURE BINARY
      ORecordBytes extRecord = iDocument.field("externalPhoto");
      photo = extRecord.toStream();
    }
  }

  @OBeforeSerialization
  public void toStream(final ODocument iDocument) {
View Full Code Here

Examples of com.orientechnologies.orient.core.record.impl.ORecordBytes.toStream()

      ORecordBytes rec = (ORecordBytes) currentRecord;
      message("\n--------------------------------------------------");
      message("\nBytes - record id: %s   v.%s", rec.getIdentity().toString(), rec.getRecordVersion().toString());
      message("\n--------------------------------------------------");

      final byte[] value = rec.toStream();
      final int max = Math.min(Integer.parseInt(properties.get("maxBinaryDisplay")), Array.getLength(value));
      for (int i = 0; i < max; ++i) {
        message("%03d", Array.getByte(value, i));
      }
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.