Class WriteBufferManager


  • public final class WriteBufferManager
    extends Object
    Class to write files using nio.
    Author:
    Fernando Gonzalez Cortes
    • Constructor Detail

      • WriteBufferManager

        public WriteBufferManager​(FileChannel channel)
                           throws IOException
        Creates a new WriteBufferManager that writes to the specified file channel
        Parameters:
        channel -
        Throws:
        IOException
    • Method Detail

      • put

        public void put​(byte b)
                 throws IOException
        Puts the specified byte at the current position
        Parameters:
        b -
        Throws:
        IOException
      • put

        public void put​(byte[] bs)
                 throws IOException
        Puts the specified bytes at the current position
        Parameters:
        bs -
        Throws:
        IOException
      • flush

        public void flush()
                   throws IOException
        flushes the cached contents into the channel. It is mandatory to call this method to finish the writing of the channel
        Throws:
        IOException
      • order

        public void order​(ByteOrder order)
        Specifies the byte order. One of the constants in ByteBuffer
        Parameters:
        order -
      • putInt

        public void putInt​(int value)
                    throws IOException
        Puts the specified int at the current position
        Parameters:
        value -
        Throws:
        IOException
      • putDouble

        public void putDouble​(double d)
                       throws IOException
        Puts the specified double at the current position
        Parameters:
        d -
        Throws:
        IOException