Class StringSource

    • Constructor Detail

      • StringSource

        public StringSource​(CharSequence content)
        Creates a new source backed by the specified string.
        Parameters:
        content - The String representation, may be empty or null.
      • StringSource

        public StringSource​(CharSequence content,
                            String location)
        Creates a new source backed by the specified string.
        Parameters:
        content - The String representation, may be empty or null.
        location - The location to report for this use, may be null.
    • Method Detail

      • getInputStream

        public InputStream getInputStream()
                                   throws IOException
        Description copied from interface: Source
        Gets a byte stream to the source contents. Closing the returned stream is the responsibility of the caller.
        Specified by:
        getInputStream in interface Source
        Returns:
        A byte stream to the source contents, never null.
        Throws:
        IOException
      • getLocation

        public String getLocation()
        Description copied from interface: Source
        Provides a user-friendly hint about the location of the source. This could be a local file path, a URI or just an empty string. The intention is to assist users during error reporting.
        Specified by:
        getLocation in interface Source
        Returns:
        A user-friendly hint about the location of the source, never null.
      • getContent

        public String getContent()
        Gets the content of this source.
        Returns:
        The underlying character stream, never null.