Class FileContent

  • All Implemented Interfaces:
    HttpContent, StreamingContent

    public final class FileContent
    extends AbstractInputStreamContent
    Concrete implementation of AbstractInputStreamContent that generates repeatable input streams based on the contents of a file.

    Sample use:

     
      private static void setRequestJpegContent(HttpRequest request, File jpegFile) {
        request.setContent(new FileContent("image/jpeg", jpegFile));
      }
     
     

    Implementation is not thread-safe.

    Since:
    1.4
    Author:
    moshenko@google.com (Jacob Moshenko)