Class AbstractOrigin.AbstractRandomAccessFileOrigin<T extends java.io.RandomAccessFile,​B extends AbstractOrigin.AbstractRandomAccessFileOrigin<T,​B>>

    • Constructor Detail

      • AbstractRandomAccessFileOrigin

        public AbstractRandomAccessFileOrigin​(T origin)
        A RandomAccessFile origin.

        Starting from this origin, you can everything except a Path and a File.

        Parameters:
        origin - The origin.
    • Method Detail

      • getByteArray

        public byte[] getByteArray​(long position,
                                   int length)
                            throws java.io.IOException
        Description copied from class: AbstractOrigin
        Gets a portion of this origin as a byte array, if possible.
        Overrides:
        getByteArray in class AbstractOrigin<T extends java.io.RandomAccessFile,​B extends AbstractOrigin.AbstractRandomAccessFileOrigin<T,​B>>
        Parameters:
        position - the initial index of the range to be copied, inclusive.
        length - How many bytes to copy.
        Returns:
        this origin as a byte array, if possible.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • getCharSequence

        public java.lang.CharSequence getCharSequence​(java.nio.charset.Charset charset)
                                               throws java.io.IOException
        Description copied from class: AbstractOrigin
        Gets this origin as a byte array, if possible.
        Overrides:
        getCharSequence in class AbstractOrigin<T extends java.io.RandomAccessFile,​B extends AbstractOrigin.AbstractRandomAccessFileOrigin<T,​B>>
        Parameters:
        charset - The charset to use if conversion from bytes is needed.
        Returns:
        this origin as a byte array, if possible.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • getInputStream

        public java.io.InputStream getInputStream​(java.nio.file.OpenOption... options)
                                           throws java.io.IOException
        Description copied from class: AbstractOrigin
        Gets this origin as an InputStream, if possible.
        Overrides:
        getInputStream in class AbstractOrigin<T extends java.io.RandomAccessFile,​B extends AbstractOrigin.AbstractRandomAccessFileOrigin<T,​B>>
        Parameters:
        options - options specifying how the file is opened
        Returns:
        this origin as an InputStream, if possible.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • getOutputStream

        public java.io.OutputStream getOutputStream​(java.nio.file.OpenOption... options)
                                             throws java.io.IOException
        Description copied from class: AbstractOrigin
        Gets this origin as an OutputStream, if possible.
        Overrides:
        getOutputStream in class AbstractOrigin<T extends java.io.RandomAccessFile,​B extends AbstractOrigin.AbstractRandomAccessFileOrigin<T,​B>>
        Parameters:
        options - options specifying how the file is opened
        Returns:
        this origin as an OutputStream, if possible.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • getReader

        public java.io.Reader getReader​(java.nio.charset.Charset charset)
                                 throws java.io.IOException
        Description copied from class: AbstractOrigin
        Gets a new Reader on the origin, buffered by default.
        Overrides:
        getReader in class AbstractOrigin<T extends java.io.RandomAccessFile,​B extends AbstractOrigin.AbstractRandomAccessFileOrigin<T,​B>>
        Parameters:
        charset - the charset to use for decoding
        Returns:
        a new Reader on the origin.
        Throws:
        java.io.IOException - if an I/O error occurs opening the file.
      • getWriter

        public java.io.Writer getWriter​(java.nio.charset.Charset charset,
                                        java.nio.file.OpenOption... options)
                                 throws java.io.IOException
        Description copied from class: AbstractOrigin
        Gets a new Writer on the origin, buffered by default.
        Overrides:
        getWriter in class AbstractOrigin<T extends java.io.RandomAccessFile,​B extends AbstractOrigin.AbstractRandomAccessFileOrigin<T,​B>>
        Parameters:
        charset - the charset to use for encoding
        options - options specifying how the file is opened
        Returns:
        a new Writer on the origin.
        Throws:
        java.io.IOException - if an I/O error occurs opening or creating the file.