Class FileBaseDefault

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.nio.channels.ByteChannel, java.nio.channels.Channel, java.nio.channels.GatheringByteChannel, java.nio.channels.InterruptibleChannel, java.nio.channels.ReadableByteChannel, java.nio.channels.ScatteringByteChannel, java.nio.channels.SeekableByteChannel, java.nio.channels.WritableByteChannel
    Direct Known Subclasses:
    FileAsync, FileEncrypt, FileMem, FileNioMapped, FileNioMem, FileSplit

    public abstract class FileBaseDefault
    extends FileBase
    Default implementation of the slow operations that need synchronization because they involve the file position.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.nio.channels.FileChannel

        java.nio.channels.FileChannel.MapMode
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private long position  
    • Constructor Summary

      Constructors 
      Constructor Description
      FileBaseDefault()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract void implTruncate​(long size)
      The truncate implementation.
      long position()  
      java.nio.channels.FileChannel position​(long newPosition)  
      int read​(java.nio.ByteBuffer dst)  
      java.nio.channels.FileChannel truncate​(long newLength)  
      int write​(java.nio.ByteBuffer src)  
      • Methods inherited from class java.nio.channels.FileChannel

        lock, open, open, read, size, tryLock, write
      • Methods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel

        begin, close, end, isOpen
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.nio.channels.Channel

        isOpen
    • Field Detail

      • position

        private long position
    • Constructor Detail

      • FileBaseDefault

        public FileBaseDefault()
    • Method Detail

      • position

        public final long position()
                            throws java.io.IOException
        Specified by:
        position in interface java.nio.channels.SeekableByteChannel
        Specified by:
        position in class java.nio.channels.FileChannel
        Throws:
        java.io.IOException
      • position

        public final java.nio.channels.FileChannel position​(long newPosition)
                                                     throws java.io.IOException
        Specified by:
        position in interface java.nio.channels.SeekableByteChannel
        Specified by:
        position in class java.nio.channels.FileChannel
        Throws:
        java.io.IOException
      • read

        public final int read​(java.nio.ByteBuffer dst)
                       throws java.io.IOException
        Specified by:
        read in interface java.nio.channels.ReadableByteChannel
        Specified by:
        read in interface java.nio.channels.SeekableByteChannel
        Specified by:
        read in class java.nio.channels.FileChannel
        Throws:
        java.io.IOException
      • write

        public final int write​(java.nio.ByteBuffer src)
                        throws java.io.IOException
        Specified by:
        write in interface java.nio.channels.SeekableByteChannel
        Specified by:
        write in interface java.nio.channels.WritableByteChannel
        Specified by:
        write in class java.nio.channels.FileChannel
        Throws:
        java.io.IOException
      • truncate

        public final java.nio.channels.FileChannel truncate​(long newLength)
                                                     throws java.io.IOException
        Specified by:
        truncate in interface java.nio.channels.SeekableByteChannel
        Specified by:
        truncate in class java.nio.channels.FileChannel
        Throws:
        java.io.IOException
      • implTruncate

        protected abstract void implTruncate​(long size)
                                      throws java.io.IOException
        The truncate implementation.
        Parameters:
        size - the new size
        Throws:
        java.io.IOException - on failure