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 
    A Source implementation that reads from an InputStream.
    static class 
    A Source implementation that reads from a file system path.
    static class 
    A Source implementation that reads from a classpath resource.
    static class 
    A Source implementation that reads from standard input.
    static class 
    A Source implementation that reads from a URL.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the name of this source.
    Gets the number of lines in this source, if known.
    Opens a stream to read the content of this source.
  • Method Details

    • getName

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

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

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