Class AbstractOrigin.CharSequenceOrigin

    • Constructor Detail

      • CharSequenceOrigin

        public CharSequenceOrigin​(java.lang.CharSequence origin)
        Constructs a new instance for the given origin.
        Parameters:
        origin - The origin.
    • Method Detail

      • getCharSequence

        public java.lang.CharSequence getCharSequence​(java.nio.charset.Charset charset)
        Description copied from class: AbstractOrigin
        Gets this origin as a byte array, if possible.
        Overrides:
        getCharSequence in class AbstractOrigin<java.lang.CharSequence,​AbstractOrigin.CharSequenceOrigin>
        Parameters:
        charset - The charset to use if conversion from bytes is needed.
        Returns:
        this origin as a byte array, if possible.
      • 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<java.lang.CharSequence,​AbstractOrigin.CharSequenceOrigin>
        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.
      • 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<java.lang.CharSequence,​AbstractOrigin.CharSequenceOrigin>
        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.
      • size

        public long size()
                  throws java.io.IOException
        Description copied from class: AbstractOrigin
        Gets the size of the origin, if possible.
        Overrides:
        size in class AbstractOrigin<java.lang.CharSequence,​AbstractOrigin.CharSequenceOrigin>
        Returns:
        the size of the origin in bytes or characters.
        Throws:
        java.io.IOException - if an I/O error occurs.