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, Serializable, Comparable<OIdentifiable>, Comparator<OIdentifiable>

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)
      Overrides:
      fromStream in class ORecordAbstract
    • 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()
      Overrides:
      toStream in class ORecordAbstract
    • 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
    • getBytes

      public byte[] getBytes()
      Specified by:
      getBytes in interface OBlob
    • setBytes

      public void setBytes(byte[] bytes)
      Specified by:
      setBytes in interface OBlob