Interface Source

  • All Known Implementing Classes:
    Source.InputStreamSource, Source.PathSource, Source.ResourceSource, Source.StdInSource, Source.URLSource

    public interface Source
    Interface representing a source of data that can be read.

    This interface provides a unified way to access data from different sources, such as files, URLs, or standard input. It abstracts away the details of how the data is accessed, allowing commands to work with different types of input sources in a consistent way.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  Source.InputStreamSource
      A Source implementation that reads from an InputStream.
      static class  Source.PathSource
      A Source implementation that reads from a file system path.
      static class  Source.ResourceSource
      A Source implementation that reads from a classpath resource.
      static class  Source.StdInSource
      A Source implementation that reads from standard input.
      static class  Source.URLSource
      A Source implementation that reads from a URL.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String getName()
      Gets the name of this source.
      java.lang.Long lines()
      Gets the number of lines in this source, if known.
      java.io.InputStream read()
      Opens a stream to read the content of this source.
    • Method Detail

      • getName

        java.lang.String getName()
        Gets the name of this source.
        Returns:
        the name of the source
      • read

        java.io.InputStream read()
                          throws java.io.IOException
        Opens a stream to read the content of this source.
        Returns:
        an input stream for reading the source content
        Throws:
        java.io.IOException - if an I/O error occurs
      • lines

        java.lang.Long lines()
        Gets the number of lines in this source, if known.
        Returns:
        the number of lines, or null if unknown