Class AbstractOrigin.InputStreamOrigin

    • Constructor Detail

      • InputStreamOrigin

        public InputStreamOrigin​(java.io.InputStream origin)
        Constructs a new instance for the given origin.
        Parameters:
        origin - The origin, not null.
        Throws:
        java.lang.NullPointerException - if origin is null.
    • Method Detail

      • getInputStream

        public java.io.InputStream getInputStream​(java.nio.file.OpenOption... options)
        Gets this origin as an InputStream, if possible.

        The options parameter is ignored since a InputStream does not need an OpenOption to be read.

        No conversion should occur when calling this method.

        Overrides:
        getInputStream in class AbstractOrigin<java.io.InputStream,​AbstractOrigin.InputStreamOrigin>
        Parameters:
        options - options specifying how the file is opened
        Returns:
        this origin as an InputStream, if possible.
      • 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.io.InputStream,​AbstractOrigin.InputStreamOrigin>
        Parameters:
        charset - the charset to use for decoding, null maps to the default Charset.
        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.io.InputStream,​AbstractOrigin.InputStreamOrigin>
        Returns:
        the size of the origin in bytes or characters.
        Throws:
        java.io.IOException - if an I/O error occurs.