Package org.jline.builtins
Interface Source
-
- All Known Implementing Classes:
Source.InputStreamSource,Source.PathSource,Source.ResourceSource,Source.StdInSource,Source.URLSource
public interface SourceInterface 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 classSource.InputStreamSourceA Source implementation that reads from an InputStream.static classSource.PathSourceA Source implementation that reads from a file system path.static classSource.ResourceSourceA Source implementation that reads from a classpath resource.static classSource.StdInSourceA Source implementation that reads from standard input.static classSource.URLSourceA Source implementation that reads from a URL.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.StringgetName()Gets the name of this source.java.lang.Longlines()Gets the number of lines in this source, if known.java.io.InputStreamread()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.IOExceptionOpens 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
-
-