FileRequestEntity (HttpClient 3.1 API)
Keywords: org.apache.commons.httpclient.methods.FileRequestEntity class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.httpclient.methods
Class FileRequestEntity

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

All Implemented Interfaces:
  RequestEntity

    public class FileRequestEntity

extends Object
implements RequestEntity

A RequestEntity that represents a File.

Since:
  3.1

Constructor Summary
`FileRequestEntity(File file, String contentType)`

Method Summary
`long` | `getContentLength()` Gets the request entity's length.
`String` | `getContentType()` Gets the entity's content type.
`boolean` | `isRepeatable()` Tests if `RequestEntity.writeRequest(OutputStream)` can be called more than once.
`void` | `writeRequest(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(File file,
                             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 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(OutputStream out)
                      throws IOException

  Description copied from interface: `RequestEntity`
  Writes the request entity to the given stream.

  Specified by:
    `writeRequest` in interface `RequestEntity`
  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.