FileRequestEntity (HttpClient Library (Version 3.1))
Date: 2019-09-02

org.apache.commons.httpclient.methods

## Class FileRequestEntity

- java.lang.Object
- - org.apache.commons.httpclient.methods.FileRequestEntity

- All Implemented Interfaces:
    RequestEntity

      public class FileRequestEntity
      extends java.lang.Object
      implements RequestEntity

  A RequestEntity that represents a File.
  Since:
    3.1

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FileRequestEntity(java.io.File file, java.lang.String contentType)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `getContentLength()` Gets the request entity's length.
    `java.lang.String` | `getContentType()` Gets the entity's content type.
    `boolean` | `isRepeatable()` Tests if `RequestEntity.writeRequest(OutputStream)` can be called more than once.
    `void` | `writeRequest(java.io.OutputStream out)` Writes the request entity to the given stream.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FileRequestEntity

          public FileRequestEntity(java.io.File file,
                                   java.lang.String contentType)

  - ### Method Detail

    - #### getContentLength

          public long getContentLength()

      Description copied from interface: `RequestEntity`
      Gets the request entity's length. This method should return a non-negative value if the content length is known or a negative value if it is not. In the latter case the `EntityEnclosingMethod` will use chunk encoding to transmit the request entity.
      Specified by:
        `getContentLength` in interface `RequestEntity`
      Returns:
        a non-negative value when content length is known or a negative value when content length is not known

    - #### getContentType

          public java.lang.String getContentType()

      Description copied from interface: `RequestEntity`
      Gets the entity's content type. This content type will be used as the value for the "Content-Type" header.
      Specified by:
        `getContentType` in interface `RequestEntity`
      Returns:
        the entity's content type
      See Also:
        `HttpMethod.setRequestHeader(String, String)`

    - #### isRepeatable

          public boolean isRepeatable()

      Description copied from interface: `RequestEntity`
      Tests if `RequestEntity.writeRequest(OutputStream)` can be called more than once.
      Specified by:
        `isRepeatable` in interface `RequestEntity`
      Returns:
        `true` if the entity can be written to `OutputStream` more than once, `false` otherwise.

    - #### writeRequest

          public void writeRequest(java.io.OutputStream out)
                            throws java.io.IOException

      Description copied from interface: `RequestEntity`
      Writes the request entity to the given stream.
      Specified by:
        `writeRequest` in interface `RequestEntity`
      Throws:
        `java.io.IOException`

Copyright (c) 1999-2005 - Apache Software Foundation