Class FileSystemCharStreamProvider

java.lang.Object
com.helger.io.provider.FileSystemCharStreamProvider
All Implemented Interfaces:
IInputStreamProvider, IOutputStreamProvider, IReaderProvider, IWriterProvider

@Immutable public final class FileSystemCharStreamProvider extends Object implements IInputStreamProvider, IOutputStreamProvider, IReaderProvider, IWriterProvider
Implementation of the IInputStreamProvider and IOutputStreamProvider interfaces for File objects.
Author:
Philip Helger
  • Constructor Details

    • FileSystemCharStreamProvider

      public FileSystemCharStreamProvider(@NonNull String sBasePath, @NonNull Charset aCharset)
      Constructor using a base path string and a charset.
      Parameters:
      sBasePath - The base path to use. May not be null. Must be an existing directory.
      aCharset - The charset to use. May not be null.
    • FileSystemCharStreamProvider

      public FileSystemCharStreamProvider(@NonNull File aBasePath, @NonNull Charset aCharset)
      Constructor using a base path file and a charset.
      Parameters:
      aBasePath - The base path to use. May not be null. Must be an existing directory.
      aCharset - The charset to use. May not be null.
  • Method Details

    • getBasePath

      public @NonNull File getBasePath()
      Returns:
      The base path as provided in the constructor. Never null.
    • getCharset

      public @NonNull Charset getCharset()
      Returns:
      The charset as provided in the constructor. Never null.
    • getInputStream

      public @Nullable InputStream getInputStream(@NonNull String sName)
      Get the input stream from the given name.
      Specified by:
      getInputStream in interface IInputStreamProvider
      Parameters:
      sName - The name to be resolved. May not be null.
      Returns:
      null if resolving failed.
    • getOutputStream

      public @Nullable OutputStream getOutputStream(@NonNull String sName, @NonNull com.helger.base.io.EAppend eAppend)
      Get the output stream from the given name.
      Specified by:
      getOutputStream in interface IOutputStreamProvider
      Parameters:
      sName - The name to be resolved. May not be null.
      eAppend - Appending mode. May not be null.
      Returns:
      null if resolving failed.
    • getReader

      public @Nullable Reader getReader(@NonNull String sName)
      Get the reader from the given name.
      Specified by:
      getReader in interface IReaderProvider
      Parameters:
      sName - The name to be resolved. May not be null.
      Returns:
      null if resolving failed.
    • getWriter

      public @Nullable Writer getWriter(@NonNull String sName, @NonNull com.helger.base.io.EAppend eAppend)
      Get the writer from the given name.
      Specified by:
      getWriter in interface IWriterProvider
      Parameters:
      sName - The name to be resolved. May not be null.
      eAppend - Appending mode. May not be null.
      Returns:
      null if resolving failed.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object