Class PlainFile

java.lang.Object
zeroecho.sdk.content.builtin.PlainFile
All Implemented Interfaces:
DataContent, PlainContent

public final class PlainFile extends Object implements PlainContent
A PlainContent implementation that reads content from a file-like URL.
  • Constructor Details

    • PlainFile

      public PlainFile(URL location)
      Constructs a PlainFile from the specified URL.
      Parameters:
      location - the file URL; must not be null
  • Method Details

    • setInput

      public void setInput(DataContent input)
      Connects this content to the output of a previous stage in the pipeline.

      This method is used to supply the input data that this content will process (e.g., a PlainContent being encrypted, or an encrypted content being decrypted).

      PlainFile represents the start of a DataContent chain and therefore must not have any input. Calling this method with a non-null argument will result in an exception.
      Specified by:
      setInput in interface DataContent
      Parameters:
      input - the preceding DataContent, which must be null
      Throws:
      IllegalArgumentException - if input is not null
    • getStream

      public InputStream getStream() throws IOException
      Returns an InputStream for reading from the file.
      Specified by:
      getStream in interface DataContent
      Returns:
      an InputStream from the URL
      Throws:
      IOException - if an I/O error occurs opening the stream