Class BaseReadableResource

All Implemented Interfaces:
Broadcaster, Listener, Repeater, Transceiver, CreatedAt, Modifiable, ModifiedAt, ByteSized, Receiver, Transmitter, NamedObject, StringSource, Deletable, Readable, ReadableResource, Resource, Resourceful, ResourcePathed, UriIdentified
Direct Known Subclasses:
BaseNetworkResource, BaseWritableResource, InputResource, PackageResource, ResourceSection, StringResource

public abstract class BaseReadableResource extends BaseRepeater implements Resource
A base implementation of the Resource interface. Adds the following methods:

All other methods are documented in the Resource superinterface.

  • Constructor Details

    • BaseReadableResource

      protected BaseReadableResource()
      For serialization
    • BaseReadableResource

      protected BaseReadableResource(ResourcePath path)
    • BaseReadableResource

      protected BaseReadableResource(BaseReadableResource that)
  • Method Details

    • charset

      public final Charset charset()
      Specified by:
      charset in interface ReadableResource
      Returns:
      The charset used by this resource
    • codec

      public Codec codec()
      Specified by:
      codec in interface Resource
      Returns:
      Any codec for compression / decompression
    • codec

      public BaseReadableResource codec(Codec codec)
    • copyTo

      public void copyTo(WritableResource destination, CopyMode mode, ProgressReporter reporter)
      Copies the data in this resource to the destination.
      Specified by:
      copyTo in interface ReadableResource
      Parameters:
      destination - The destination to write to
    • delete

      public boolean delete()
      Description copied from interface: Deletable
      Returns true if the object was deleted, false otherwise
      Specified by:
      delete in interface Deletable
    • dematerialize

      public void dematerialize()
      Remove any materialized local copy if this is a remote resource that's been cached
      Specified by:
      dematerialize in interface Resource
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • exists

      public boolean exists()
      Specified by:
      exists in interface Resource
      Returns:
      True if the resource exists
    • hashCode

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

      public Resource materialized(ProgressReporter reporter)
      Specified by:
      materialized in interface Resource
      Returns:
      A local cached copy of this resource if it is remote.
    • openForReading

      public InputStream openForReading(ProgressReporter reporter)
      Description copied from interface: Readable
      Opens something that can be read, returning an input stream. The given progress reporter is called for each byte that is read from the input stream. If the input size is known (meaning that Readable.sizeInBytes() returns a non-null value), the reporter will be initialized with the number of bytes to allow percent completion to be computed as the stream is read.
      Specified by:
      openForReading in interface Readable
      Parameters:
      reporter - A progress reporter that is called for each byte that is read
      Returns:
      The input stream to read from
    • path

      public ResourcePath path()
      Description copied from interface: Resource
      StringPath to this resource
      Specified by:
      path in interface Resource
      Specified by:
      path in interface ResourcePathed
      Returns:
      The path to this object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • charset

      protected void charset(Charset charset)