Examples of OMemoryInputStream


Examples of com.orientechnologies.orient.core.serialization.OMemoryInputStream

  public String getText() {
    return text;
  }

  public OSerializableStream fromStream(byte[] iStream) throws OSerializationException {
    final OMemoryInputStream buffer = new OMemoryInputStream(iStream);
    try {
      text = buffer.getAsString();

      byte[] paramBuffer = buffer.getAsByteArray();

      if (paramBuffer.length == 0)
        parameters = null;
      else {
        final ODocument param = new ODocument(database);
View Full Code Here

Examples of com.orientechnologies.orient.core.serialization.OMemoryInputStream

  }

  @Override
  public byte[] uncompress(byte[] content, final int offset, final int length) {
    try {
      final OMemoryInputStream memoryInputStream = new OMemoryInputStream(content, offset, length);
      final GZIPInputStream gzipInputStream = new GZIPInputStream(memoryInputStream, 16384); // 16KB

      try {
        final byte[] buffer = new byte[1024];
        byte[] result = new byte[1024];
View Full Code Here

Examples of com.orientechnologies.orient.core.serialization.OMemoryInputStream

  }

  @Override
  public byte[] uncompress(final byte[] content, final int offset, final int length) {
    try {
      final OMemoryInputStream memoryInputStream = new OMemoryInputStream(content, offset, length);
      final ZipInputStream gzipInputStream = new ZipInputStream(memoryInputStream); // 16KB

      try {
        final byte[] buffer = new byte[1024];
        byte[] result = new byte[1024];
View Full Code Here

Examples of com.orientechnologies.orient.core.serialization.OMemoryInputStream

    final OMemoryStream memoryStream = new OMemoryStream();
    ObjectOutputStream out = new ObjectOutputStream(memoryStream);
    out.writeObject(beforeSerialization);
    out.close();

    final ObjectInputStream input = new ObjectInputStream(new OMemoryInputStream(memoryStream.copy()));
    @SuppressWarnings("unchecked")
    final List<String> afterSerialization = (List<String>) input.readObject();

    Assert.assertEquals(afterSerialization.size(), beforeSerialization.size(), "List size");
    for (int i = 0; i < afterSerialization.size(); i++) {
View Full Code Here

Examples of com.orientechnologies.orient.core.serialization.OMemoryInputStream

    final OMemoryStream memoryStream = new OMemoryStream();
    final ObjectOutputStream out = new ObjectOutputStream(memoryStream);
    out.writeObject(beforeSerialization);
    out.close();

    final ObjectInputStream input = new ObjectInputStream(new OMemoryInputStream(memoryStream.copy()));
    @SuppressWarnings("unchecked")
    final Map<Object, String> afterSerialization = (Map<Object, String>) input.readObject();

    Assert.assertEquals(afterSerialization.size(), beforeSerialization.size(), "Map size");
    for (int i = 0; i < afterSerialization.size(); i++) {
View Full Code Here

Examples of com.orientechnologies.orient.core.serialization.OMemoryInputStream

    final OMemoryStream memoryStream = new OMemoryStream();
    ObjectOutputStream out = new ObjectOutputStream(memoryStream);
    out.writeObject(beforeSerialization);
    out.close();

    final ObjectInputStream input = new ObjectInputStream(new OMemoryInputStream(memoryStream.copy()));
    @SuppressWarnings("unchecked")
    final Set<String> afterSerialization = (Set<String>) input.readObject();

    Assert.assertEquals(afterSerialization.size(), beforeSerialization.size(), "Set size");
    Assert.assertTrue(beforeSerialization.containsAll(afterSerialization));
View Full Code Here

Examples of com.orientechnologies.orient.core.serialization.OMemoryInputStream

    throw new UnsupportedOperationException("CSV storage format is out of dated and is not supported.");
  }

  public Object fromStream(final byte[] iStream) throws IOException {
    final OCompositeKey compositeKey = new OCompositeKey();
    final OMemoryInputStream inputStream = new OMemoryInputStream(iStream);

    final int keysSize = inputStream.getAsInteger();
    for (int i = 0; i < keysSize; i++) {
      final byte[] keyBytes = inputStream.getAsByteArray();
      final String keyString = OBinaryProtocol.bytes2string(keyBytes);
      final int typeSeparatorPos = keyString.indexOf(',');
      final OType type = OType.valueOf(keyString.substring(0, typeSeparatorPos));
      compositeKey.addKey(ORecordSerializerStringAbstract.simpleValueFromStream(keyString.substring(typeSeparatorPos + 1), type));
    }
View Full Code Here

Examples of com.orientechnologies.orient.core.serialization.OMemoryInputStream

      throw new ONetworkProtocolException("Error on reading response from the server");
    }
  }

  private void throwSerializedException(final byte[] serializedException) throws IOException {
    final OMemoryInputStream inputStream = new OMemoryInputStream(serializedException);
    final ObjectInputStream objectInputStream = new ObjectInputStream(inputStream);

    Object throwable = null;
    try {
      throwable = objectInputStream.readObject();
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.