Class FileResource

java.lang.Object
org.apache.juneau.http.classic.resource.BasicResource<FileResource>
org.apache.juneau.http.classic.resource.FileResource
All Implemented Interfaces:
HttpEntity, HttpResource
Direct Known Subclasses:
FileResource.Unmodifiable

A repeatable resource that obtains its content from a File.
See Also:
  • Constructor Details

    • FileResource

      public FileResource()
      Constructor.
    • FileResource

      public FileResource(ContentType contentType, File contents)
      Constructor.
      Parameters:
      contentType - The entity content type. Can be null to omit an explicit Content-Type header.
      contents - The entity contents. Can be null, in which case a NullPointerException is thrown when the resource's content is read.
    • FileResource

      protected FileResource(FileResource copyFrom)
      Copy constructor.
      Parameters:
      copyFrom - The bean being copied. Must not be null.
  • Method Details

    • copy

      public FileResource copy()
      Description copied from class: BasicResource
      Creates a builder for this class initialized with the contents of this bean.

      Allows you to create a modifiable copy of this bean.

      Specified by:
      copy in class BasicResource<FileResource>
      Returns:
      A new builder bean.
    • unmodifiable

      Description copied from class: BasicResource
      Returns an unmodifiable snapshot of this bean.

      Idempotency: if this bean is already an unmodifiable snapshot, it is returned as-is.

      Specified by:
      unmodifiable in class BasicResource<FileResource>
      Returns:
      An unmodifiable snapshot of this bean, or this bean if it is already unmodifiable.