Package com.db4o.io

Class BinDecorator

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Bin _bin  
    • Constructor Summary

      Constructors 
      Constructor Description
      BinDecorator​(Bin bin)
      Default constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      closes the BinDecorator and the underlying Bin.
      long length()
      returns the length of the Bin (on disc, in memory).
      int read​(long position, byte[] bytes, int bytesToRead)
      reads a given number of bytes into an array of bytes at an offset position.
      void sync()
      flushes the buffer content to the physical storage media.
      void sync​(java.lang.Runnable runnable)
      runs the Runnable between two calls to sync();
      int syncRead​(long position, byte[] bytes, int bytesToRead)
      reads a given number of bytes into an array of bytes at an offset position.
      void write​(long position, byte[] bytes, int bytesToWrite)
      writes a given number of bytes from an array of bytes at an offset position
      • Methods inherited from class java.lang.Object

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

      • _bin

        protected final Bin _bin
    • Constructor Detail

      • BinDecorator

        public BinDecorator​(Bin bin)
        Default constructor.
        Parameters:
        bin - the Bin that is to be wrapped.
    • Method Detail

      • close

        public void close()
        closes the BinDecorator and the underlying Bin.
        Specified by:
        close in interface Bin
      • length

        public long length()
        Description copied from interface: Bin
        returns the length of the Bin (on disc, in memory).
        Specified by:
        length in interface Bin
        See Also:
        Bin.length()
      • read

        public int read​(long position,
                        byte[] bytes,
                        int bytesToRead)
        Description copied from interface: Bin
        reads a given number of bytes into an array of bytes at an offset position.
        Specified by:
        read in interface Bin
        Parameters:
        position - the offset position to read at
        bytes - the byte array to read bytes into
        bytesToRead - the number of bytes to be read
        Returns:
        The number of bytes actually read (<= bytesToRead) or -1 if position already points to/exceeds the end of the bin
        See Also:
        Bin.read(long, byte[], int)
      • sync

        public void sync()
        Description copied from interface: Bin
        flushes the buffer content to the physical storage media.
        Specified by:
        sync in interface Bin
        See Also:
        Bin.sync()
      • syncRead

        public int syncRead​(long position,
                            byte[] bytes,
                            int bytesToRead)
        Description copied from interface: Bin
        reads a given number of bytes into an array of bytes at an offset position. In contrast to the normal Bin.read(long, byte[], int) method, the Bin should ensure direct access to the raw storage medium. No caching should take place.
        Specified by:
        syncRead in interface Bin
        Parameters:
        position - the offset position to read at
        bytes - the byte array to read bytes into
        bytesToRead - the number of bytes to be read
        Returns:
        See Also:
        Bin.syncRead(long, byte[], int)
      • write

        public void write​(long position,
                          byte[] bytes,
                          int bytesToWrite)
        Description copied from interface: Bin
        writes a given number of bytes from an array of bytes at an offset position
        Specified by:
        write in interface Bin
        Parameters:
        position - the offset position to write at
        bytes - the array of bytes to write
        bytesToWrite - the number of bytes to write
        See Also:
        Bin.write(long, byte[], int)
      • sync

        public void sync​(java.lang.Runnable runnable)
        Description copied from interface: Bin
        runs the Runnable between two calls to sync();
        Specified by:
        sync in interface Bin