Class ORecordBytes

java.lang.Object
com.orientechnologies.orient.core.record.ORecordAbstract
com.orientechnologies.orient.core.record.impl.ORecordBytes
All Implemented Interfaces:
OIdentifiable, ORecordElement, OBlob, ORecord, OSerializableStream, Serializable, Comparable<OIdentifiable>, Comparator<OIdentifiable>
Direct Known Subclasses:
ORecordBytesLazy

public class ORecordBytes extends ORecordAbstract implements OBlob
The rawest representation of a record. It's schema less. Use this if you need to store Strings or byte[] without matter about the content. Useful also to store multimedia contents and binary files. The object can be reused across calls to the database by using the reset() at every re-use.
See Also:
  • Constructor Details

    • ORecordBytes

      public ORecordBytes()
    • ORecordBytes

      public ORecordBytes(ODatabaseDocumentInternal iDatabase)
    • ORecordBytes

      public ORecordBytes(ODatabaseDocumentInternal iDatabase, byte[] iSource)
    • ORecordBytes

      public ORecordBytes(byte[] iSource)
    • ORecordBytes

      public ORecordBytes(ORID iRecordId)
  • Method Details

    • reset

      public ORecordBytes reset(byte[] iSource)
    • copy

      public ORecordBytes copy()
      Description copied from interface: ORecord
      Creates a copy of the record. All the record contents are copied.
      Specified by:
      copy in interface ORecord
      Returns:
      The Object instance itself giving a "fluent interface". Useful to call multiple methods in chain.
    • fromStream

      public ORecordBytes fromStream(byte[] iRecordBuffer)
      Description copied from interface: OSerializableStream
      Unmarshalls the object. Fills the current object with the values contained in the byte array representation restoring a previous state. Usually byte[] comes from the storage or network.
      Specified by:
      fromStream in interface OSerializableStream
      Overrides:
      fromStream in class ORecordAbstract
      Parameters:
      iRecordBuffer - byte array representation of the object
      Returns:
      The Object instance itself giving a "fluent interface". Useful to call multiple methods in chain.
    • clear

      public ORecordAbstract clear()
      Description copied from interface: ORecord
      All the fields are deleted but the record identity is maintained. Use this to remove all the document's fields.
      Specified by:
      clear in interface ORecord
      Overrides:
      clear in class ORecordAbstract
      Returns:
      The Object instance itself giving a "fluent interface". Useful to call multiple methods in chain.
    • toStream

      public byte[] toStream()
      Description copied from interface: OSerializableStream
      Marshalls the object. Transforms the current object in byte[] form to being stored or transferred over the network.
      Specified by:
      toStream in interface OSerializableStream
      Overrides:
      toStream in class ORecordAbstract
      Returns:
      The byte array representation of the object
      See Also:
    • getRecordType

      public byte getRecordType()
      Specified by:
      getRecordType in class ORecordAbstract
    • setup

      protected void setup(ODatabaseDocumentInternal db)
      Overrides:
      setup in class ORecordAbstract
    • fromInputStream

      public int fromInputStream(InputStream in) throws IOException
      Reads the input stream in memory. This is less efficient than fromInputStream(InputStream, int) because allocation is made multiple times. If you already know the input size use fromInputStream(InputStream, int).
      Specified by:
      fromInputStream in interface OBlob
      Parameters:
      in - Input Stream, use buffered input stream wrapper to speed up reading
      Returns:
      Buffer read from the stream. It's also the internal buffer size in bytes
      Throws:
      IOException
    • fromInputStream

      public int fromInputStream(InputStream in, int maxSize) throws IOException
      Reads the input stream in memory specifying the maximum bytes to read. This is more efficient than fromInputStream(InputStream) because allocation is made only once.
      Specified by:
      fromInputStream in interface OBlob
      Parameters:
      in - Input Stream, use buffered input stream wrapper to speed up reading
      maxSize - Maximum size to read
      Returns:
      Buffer count of bytes that are read from the stream. It's also the internal buffer size in bytes
      Throws:
      IOException - if an I/O error occurs.
    • toOutputStream

      public void toOutputStream(OutputStream out) throws IOException
      Specified by:
      toOutputStream in interface OBlob
      Throws:
      IOException