Package com.orientechnologies.orient.core.serialization

Examples of com.orientechnologies.orient.core.serialization.OMemoryStream.toByteArray()


      final OMemoryStream memoryOutputStream = new OMemoryStream();
      final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(memoryOutputStream, 16384); // 16KB
      try {
        gzipOutputStream.write(content, offset, length);
        gzipOutputStream.finish();
        result = memoryOutputStream.toByteArray();
      } finally {
        gzipOutputStream.close();
      }

      return result;
View Full Code Here


        } finally {
          zipOutputStream.closeEntry();
        }

        zipOutputStream.finish();
        result = memoryOutputStream.toByteArray();
      } finally {
        zipOutputStream.close();
      }

      return result;
View Full Code Here

          break;
        }
        out.write(buffer, 0, readBytesCount);
      }
      out.flush();
      _source = out.toByteArray();
    } finally {
      out.close();
    }
    _size = _source.length;
    return _size;
View Full Code Here

       final ObjectOutputStream objectOutputStream = new ObjectOutputStream(memoryStream);

       objectOutputStream.writeObject(original);
       objectOutputStream.flush();

       final byte[] result = memoryStream.toByteArray();
       objectOutputStream.close();

       channel.writeBytes(result);
     } catch (Exception e) {
       OLogManager.instance().warn(this, "Can't serialize an exception object", e);
View Full Code Here

      outStream.jump(offset);

      for (int i = 0; i < size; ++i)
        serializedValues[i] = outStream.set(serializeStreamValue(i));

      buffer = outStream.toByteArray();
    } finally {
      outStream.close();
    }

    if (stream == null)
View Full Code Here

      outStream.jump(offset);

      for (int i = 0; i < oldSize; ++i)
        outStream.set(valueSerializer.toStream(oldValues[i]));

      return outStream.toByteArray();

    } finally {
      outStream.close();
    }
  }
View Full Code Here

        stream.set(ORecordInternal.getRecordType(record.getRecord()));
        stream.set(record.getRecord().toStream());
        break;
      }

      return stream.toByteArray();

    } catch (Exception e) {
      throw new OSerializationException("Cannot serialize record operation", e);
    }
  }
View Full Code Here

      mou.set((byte) 32);
    }

    System.out.println("OMemoryStream " + (System.currentTimeMillis() - time));

    System.out.println("" + s.toByteArray().length + " " + mou.toByteArray().length);

  }
}
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.