Class ByteArrayData

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected byte[] data  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean compareTo​(BinaryData other)  
      BinaryData copy()
      Creates copy of all data.
      BinaryData copy​(long startFrom, long length)
      Creates copy of given area.
      void copyToArray​(long startFrom, byte[] target, int offset, int length)
      Creates copy of given area into array of bytes.
      void dispose()
      Disposes all allocated data if possible.
      boolean equals​(java.lang.Object obj)  
      byte getByte​(long position)
      Returns particular byte from data.
      byte[] getData()
      Returns internal data.
      java.io.InputStream getDataInputStream()
      Provides handler for input stream generation.
      int getDataLength()
      Returns internal data length.
      long getDataSize()
      Returns size of data or -1 if size is not available.
      int hashCode()  
      boolean isEmpty()
      Returns true if data are empty.
      void saveToStream​(java.io.OutputStream outputStream)
      Saves/copies all data to given stream.
      void setData​(byte[] data)
      Sets internal data.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • data

        @Nonnull
        protected byte[] data
    • Constructor Detail

      • ByteArrayData

        public ByteArrayData()
      • ByteArrayData

        public ByteArrayData​(@Nullable
                             byte[] data)
    • Method Detail

      • getData

        @Nonnull
        public byte[] getData()
        Returns internal data.
        Specified by:
        getData in interface DataPage
        Returns:
        byte array
      • setData

        public void setData​(byte[] data)
        Sets internal data.
        Specified by:
        setData in interface DataPage
        Parameters:
        data - byte array
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: BinaryData
        Returns true if data are empty.
        Specified by:
        isEmpty in interface BinaryData
        Returns:
        true if data empty
      • getDataSize

        public long getDataSize()
        Description copied from interface: BinaryData
        Returns size of data or -1 if size is not available.
        Specified by:
        getDataSize in interface BinaryData
        Returns:
        size of data in bytes
      • getDataLength

        public int getDataLength()
        Returns internal data length.
        Specified by:
        getDataLength in interface DataPage
        Returns:
        data length
      • getByte

        public byte getByte​(long position)
        Description copied from interface: BinaryData
        Returns particular byte from data.
        Specified by:
        getByte in interface BinaryData
        Parameters:
        position - position
        Returns:
        byte on requested position
      • copy

        @Nonnull
        public BinaryData copy()
        Description copied from interface: BinaryData
        Creates copy of all data.
        Specified by:
        copy in interface BinaryData
        Returns:
        copy of data
      • copy

        @Nonnull
        public BinaryData copy​(long startFrom,
                               long length)
        Description copied from interface: BinaryData
        Creates copy of given area.
        Specified by:
        copy in interface BinaryData
        Parameters:
        startFrom - position to start copy from
        length - length of area
        Returns:
        copy of data
      • copyToArray

        public void copyToArray​(long startFrom,
                                byte[] target,
                                int offset,
                                int length)
        Description copied from interface: BinaryData
        Creates copy of given area into array of bytes.
        Specified by:
        copyToArray in interface BinaryData
        Parameters:
        startFrom - position to start copy from
        target - target byte array
        offset - offset position in target
        length - length of area to copy
      • saveToStream

        public void saveToStream​(java.io.OutputStream outputStream)
                          throws java.io.IOException
        Description copied from interface: BinaryData
        Saves/copies all data to given stream.
        Specified by:
        saveToStream in interface BinaryData
        Parameters:
        outputStream - output stream
        Throws:
        java.io.IOException - if input/output error
      • getDataInputStream

        @Nonnull
        public java.io.InputStream getDataInputStream()
        Description copied from interface: BinaryData
        Provides handler for input stream generation.
        Specified by:
        getDataInputStream in interface BinaryData
        Returns:
        new instance of input stream
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(@Nullable
                              java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • compareTo

        public boolean compareTo​(BinaryData other)
      • dispose

        public void dispose()
        Description copied from interface: BinaryData
        Disposes all allocated data if possible.
        Specified by:
        dispose in interface BinaryData