Class TextReader

java.lang.Object
org.springframework.ai.reader.TextReader
All Implemented Interfaces:
Supplier<List<Document>>, DocumentReader

public class TextReader extends Object implements DocumentReader
A DocumentReader that reads text from a Resource.
Author:
Craig Walls, Christian Tzolov
  • Field Details

  • Constructor Details

    • TextReader

      public TextReader(String resourceUrl)
    • TextReader

      public TextReader(org.springframework.core.io.Resource resource)
  • Method Details

    • getCharset

      public Charset getCharset()
    • setCharset

      public void setCharset(Charset charset)
    • getCustomMetadata

      public Map<String,Object> getCustomMetadata()
      Metadata associated with all documents created by the loader.
      Returns:
      Metadata to be assigned to the output Documents.
    • get

      public List<Document> get()
      Specified by:
      get in interface Supplier<List<Document>>
    • getResourceIdentifier

      protected String getResourceIdentifier(org.springframework.core.io.Resource resource)