Interface IWritableResourceProvider

All Superinterfaces:
IReadableResourceProvider
All Known Implementing Classes:
DefaultResourceProvider, FileSystemResourceProvider, WritableResourceProviderChain

@MustImplementEqualsAndHashcode public interface IWritableResourceProvider extends IReadableResourceProvider
Resource provider interface for readable and writable resources.
Author:
Philip Helger
  • Method Details

    • supportsWriting

      boolean supportsWriting(@Nullable String sName)
      Check if this resource provider can handle the resource with the passed name. If there is no real check on whether your resource provider can handle it, simply return true.
      Parameters:
      sName - The name to check. May be null.
      Returns:
      true if the name is not null and can be handled by this provider, false otherwise.
    • getWritableResource

      @Nonnull IWritableResource getWritableResource(@Nonnull String sName)
      Get the resource specified by the given name for writing.
      Parameters:
      sName - The name of the resource to resolve.
      Returns:
      The writable resource. Never null.
    • getOutputStream

      @Nullable default OutputStream getOutputStream(@Nonnull String sName, @Nonnull EAppend eAppend)
      Get the OutputStream specified by the given name for reading. This method may be called without prior call to supportsWriting(String).
      Parameters:
      sName - The name of the resource to resolve.
      eAppend - Appending mode. May not be null.
      Returns:
      The OutputStream. May be null if the underlying resource does not exist and cannot be created or if supportsWriting(String) returns false.