Class LocalFileRandomAccessContent

    • Field Detail

      • raf

        private final java.io.RandomAccessFile raf
      • rafis

        private final java.io.InputStream rafis
    • Method Detail

      • close

        public void close()
                   throws java.io.IOException
        Description copied from interface: RandomAccessContent
        Closes this random access file stream and releases any system resources associated with the stream.

        A closed random access file cannot perform input or output operations and cannot be reopened.

        If this file has an associated channel then the channel is closed as well.

        Throws:
        java.io.IOException - if an I/O error occurs.
      • getFilePointer

        public long getFilePointer()
                            throws java.io.IOException
        Description copied from interface: RandomAccessContent
        Returns the current offset in this file.
        Returns:
        the offset from the beginning of the file, in bytes, at which the next read or write occurs.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • getInputStream

        public java.io.InputStream getInputStream()
                                           throws java.io.IOException
        Description copied from interface: RandomAccessContent
        Get the input stream.

        Notice: If you use RandomAccessContent.seek(long) you have to re-get the InputStream

        Returns:
        the InputStream.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • length

        public long length()
                    throws java.io.IOException
        Description copied from interface: RandomAccessContent
        Returns the length of this file.
        Returns:
        the length of this file, measured in bytes.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • readBoolean

        public boolean readBoolean()
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • readByte

        public byte readByte()
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • readChar

        public char readChar()
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • readDouble

        public double readDouble()
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • readFloat

        public float readFloat()
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • readFully

        public void readFully​(byte[] b)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • readFully

        public void readFully​(byte[] b,
                              int off,
                              int len)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • readInt

        public int readInt()
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • readLong

        public long readLong()
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • readShort

        public short readShort()
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • readUnsignedByte

        public int readUnsignedByte()
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • readUnsignedShort

        public int readUnsignedShort()
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • readUTF

        public java.lang.String readUTF()
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • seek

        public void seek​(long pos)
                  throws java.io.IOException
        Description copied from interface: RandomAccessContent
        Sets the file-pointer offset, measured from the beginning of this file, at which the next read or write occurs.

        The offset may be set beyond the end of the file. Setting the offset beyond the end of the file does not change the file length. The file length will change only by writing after the offset has been set beyond the end of the file.

        Notice: If you use RandomAccessContent.getInputStream() you have to re-get the InputStream after calling RandomAccessContent.seek(long)

        Parameters:
        pos - the offset position, measured in bytes from the beginning of the file, at which to set the file pointer.
        Throws:
        java.io.IOException - if pos is less than 0 or if an I/O error occurs.
      • setLength

        public void setLength​(long newLength)
                       throws java.io.IOException
        Description copied from interface: RandomAccessContent
        Sets the length of this content.

        If the the newLength argument is smaller than RandomAccessContent.length(), the content is truncated.

        If the the newLength argument is greater than RandomAccessContent.length(), the content grows with undefined data.

        Parameters:
        newLength - The desired content length
        Throws:
        java.io.IOException - If an I/O error occurs
      • skipBytes

        public int skipBytes​(int n)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • write

        public void write​(byte[] b)
                   throws java.io.IOException
        Specified by:
        write in interface java.io.DataOutput
        Overrides:
        write in class AbstractRandomAccessContent
        Throws:
        java.io.IOException
      • write

        public void write​(byte[] b,
                          int off,
                          int len)
                   throws java.io.IOException
        Specified by:
        write in interface java.io.DataOutput
        Overrides:
        write in class AbstractRandomAccessContent
        Throws:
        java.io.IOException
      • write

        public void write​(int b)
                   throws java.io.IOException
        Specified by:
        write in interface java.io.DataOutput
        Overrides:
        write in class AbstractRandomAccessContent
        Throws:
        java.io.IOException
      • writeBoolean

        public void writeBoolean​(boolean v)
                          throws java.io.IOException
        Specified by:
        writeBoolean in interface java.io.DataOutput
        Overrides:
        writeBoolean in class AbstractRandomAccessContent
        Throws:
        java.io.IOException
      • writeByte

        public void writeByte​(int v)
                       throws java.io.IOException
        Specified by:
        writeByte in interface java.io.DataOutput
        Overrides:
        writeByte in class AbstractRandomAccessContent
        Throws:
        java.io.IOException
      • writeBytes

        public void writeBytes​(java.lang.String s)
                        throws java.io.IOException
        Specified by:
        writeBytes in interface java.io.DataOutput
        Overrides:
        writeBytes in class AbstractRandomAccessContent
        Throws:
        java.io.IOException
      • writeChar

        public void writeChar​(int v)
                       throws java.io.IOException
        Specified by:
        writeChar in interface java.io.DataOutput
        Overrides:
        writeChar in class AbstractRandomAccessContent
        Throws:
        java.io.IOException
      • writeChars

        public void writeChars​(java.lang.String s)
                        throws java.io.IOException
        Specified by:
        writeChars in interface java.io.DataOutput
        Overrides:
        writeChars in class AbstractRandomAccessContent
        Throws:
        java.io.IOException
      • writeDouble

        public void writeDouble​(double v)
                         throws java.io.IOException
        Specified by:
        writeDouble in interface java.io.DataOutput
        Overrides:
        writeDouble in class AbstractRandomAccessContent
        Throws:
        java.io.IOException
      • writeFloat

        public void writeFloat​(float v)
                        throws java.io.IOException
        Specified by:
        writeFloat in interface java.io.DataOutput
        Overrides:
        writeFloat in class AbstractRandomAccessContent
        Throws:
        java.io.IOException
      • writeInt

        public void writeInt​(int v)
                      throws java.io.IOException
        Specified by:
        writeInt in interface java.io.DataOutput
        Overrides:
        writeInt in class AbstractRandomAccessContent
        Throws:
        java.io.IOException
      • writeLong

        public void writeLong​(long v)
                       throws java.io.IOException
        Specified by:
        writeLong in interface java.io.DataOutput
        Overrides:
        writeLong in class AbstractRandomAccessContent
        Throws:
        java.io.IOException
      • writeShort

        public void writeShort​(int v)
                        throws java.io.IOException
        Specified by:
        writeShort in interface java.io.DataOutput
        Overrides:
        writeShort in class AbstractRandomAccessContent
        Throws:
        java.io.IOException
      • writeUTF

        public void writeUTF​(java.lang.String str)
                      throws java.io.IOException
        Specified by:
        writeUTF in interface java.io.DataOutput
        Overrides:
        writeUTF in class AbstractRandomAccessContent
        Throws:
        java.io.IOException