Package com.db4o.io

Class BlockAwareBin

  • All Implemented Interfaces:
    Bin

    public class BlockAwareBin
    extends BinDecorator
    • Constructor Summary

      Constructors 
      Constructor Description
      BlockAwareBin​(Bin bin)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void blockCopy​(int oldAddress, int oldAddressOffset, int newAddress, int newAddressOffset, int length)
      copies a block within a file in block mode
      int blockRead​(int address, byte[] buffer)
      reads a buffer at the seeked address
      int blockRead​(int address, byte[] bytes, int length)
      implement to read a buffer at the seeked address
      int blockRead​(int address, int offset, byte[] buffer)
      reads a buffer at the seeked address
      int blockRead​(int address, int offset, byte[] bytes, int length)
      implement to read a buffer at the seeked address
      int blockSize()
      returns the block size currently used
      void blockSize​(int blockSize)
      outside call to set the block size of this adapter
      void blockWrite​(int address, byte[] buffer)
      reads a buffer at the seeked address
      void blockWrite​(int address, byte[] bytes, int length)
      implement to read a buffer at the seeked address
      void blockWrite​(int address, int offset, byte[] buffer)
      reads a buffer at the seeked address
      void blockWrite​(int address, int offset, byte[] bytes, int length)
      implement to read a buffer at the seeked address
      void copy​(long oldAddress, long newAddress, int length)
      copies a block within a file in absolute mode
      int read​(long pos, byte[] buffer)
      reads a buffer at the seeked address
      protected long regularAddress​(int blockAddress, int blockAddressOffset)
      converts address and address offset to an absolute address
      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();
      void write​(long pos, byte[] bytes)
      writes a buffer to the seeked address
      • Methods inherited from class java.lang.Object

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

      • BlockAwareBin

        public BlockAwareBin​(Bin bin)
    • Method Detail

      • regularAddress

        protected final long regularAddress​(int blockAddress,
                                            int blockAddressOffset)
        converts address and address offset to an absolute address
      • blockCopy

        public void blockCopy​(int oldAddress,
                              int oldAddressOffset,
                              int newAddress,
                              int newAddressOffset,
                              int length)
                       throws Db4oIOException
        copies a block within a file in block mode
        Throws:
        Db4oIOException
      • copy

        public void copy​(long oldAddress,
                         long newAddress,
                         int length)
                  throws Db4oIOException
        copies a block within a file in absolute mode
        Throws:
        Db4oIOException
      • blockRead

        public int blockRead​(int address,
                             int offset,
                             byte[] buffer)
                      throws Db4oIOException
        reads a buffer at the seeked address
        Returns:
        the number of bytes read and returned
        Throws:
        Db4oIOException
      • blockRead

        public int blockRead​(int address,
                             int offset,
                             byte[] bytes,
                             int length)
                      throws Db4oIOException
        implement to read a buffer at the seeked address
        Throws:
        Db4oIOException
      • blockRead

        public int blockRead​(int address,
                             byte[] buffer)
                      throws Db4oIOException
        reads a buffer at the seeked address
        Returns:
        the number of bytes read and returned
        Throws:
        Db4oIOException
      • blockRead

        public int blockRead​(int address,
                             byte[] bytes,
                             int length)
                      throws Db4oIOException
        implement to read a buffer at the seeked address
        Throws:
        Db4oIOException
      • read

        public int read​(long pos,
                        byte[] buffer)
                 throws Db4oIOException
        reads a buffer at the seeked address
        Returns:
        the number of bytes read and returned
        Throws:
        Db4oIOException
      • blockWrite

        public void blockWrite​(int address,
                               int offset,
                               byte[] buffer)
                        throws Db4oIOException
        reads a buffer at the seeked address
        Throws:
        Db4oIOException
      • blockWrite

        public void blockWrite​(int address,
                               int offset,
                               byte[] bytes,
                               int length)
                        throws Db4oIOException
        implement to read a buffer at the seeked address
        Throws:
        Db4oIOException
      • blockWrite

        public void blockWrite​(int address,
                               byte[] buffer)
                        throws Db4oIOException
        reads a buffer at the seeked address
        Throws:
        Db4oIOException
      • blockWrite

        public void blockWrite​(int address,
                               byte[] bytes,
                               int length)
                        throws Db4oIOException
        implement to read a buffer at the seeked address
        Throws:
        Db4oIOException
      • sync

        public void sync()
        Description copied from interface: Bin
        flushes the buffer content to the physical storage media.
        Specified by:
        sync in interface Bin
        Overrides:
        sync in class BinDecorator
        See Also:
        Bin.sync()
      • 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
        Overrides:
        sync in class BinDecorator
      • blockSize

        public int blockSize()
        returns the block size currently used
      • blockSize

        public void blockSize​(int blockSize)
        outside call to set the block size of this adapter