Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.commons.httpclient.methods.multipart
Class FilePart  view FilePart download FilePart.java

java.lang.Object
  extended byorg.apache.commons.httpclient.methods.multipart.Part
      extended byorg.apache.commons.httpclient.methods.multipart.PartBase
          extended byorg.apache.commons.httpclient.methods.multipart.FilePart

public class FilePart
extends PartBase

This class implements a part of a Multipart post object that consists of a file.

Since:
2.0

Field Summary
static java.lang.String DEFAULT_CHARSET
          Default charset of file attachments.
static java.lang.String DEFAULT_CONTENT_TYPE
          Default content encoding of file attachments.
static java.lang.String DEFAULT_TRANSFER_ENCODING
          Default transfer encoding of file attachments.
protected static java.lang.String FILE_NAME
          Attachment's file name
protected static byte[] FILE_NAME_BYTES
          Attachment's file name as a byte array
private static org.apache.commons.logging.Log LOG
          Log object for this class.
private  PartSource source
          Source of the file part.
 
Fields inherited from class org.apache.commons.httpclient.methods.multipart.PartBase
 
Fields inherited from class org.apache.commons.httpclient.methods.multipart.Part
BOUNDARY, BOUNDARY_BYTES, CHARSET, CHARSET_BYTES, CONTENT_DISPOSITION, CONTENT_DISPOSITION_BYTES, CONTENT_TRANSFER_ENCODING, CONTENT_TRANSFER_ENCODING_BYTES, CONTENT_TYPE, CONTENT_TYPE_BYTES, CRLF, CRLF_BYTES, EXTRA, EXTRA_BYTES, QUOTE, QUOTE_BYTES
 
Constructor Summary
FilePart(java.lang.String name, java.io.File file)
          FilePart Constructor.
FilePart(java.lang.String name, java.io.File file, java.lang.String contentType, java.lang.String charset)
          FilePart Constructor.
FilePart(java.lang.String name, PartSource partSource)
          FilePart Constructor.
FilePart(java.lang.String name, PartSource partSource, java.lang.String contentType, java.lang.String charset)
          FilePart Constructor.
FilePart(java.lang.String name, java.lang.String fileName, java.io.File file)
          FilePart Constructor.
FilePart(java.lang.String name, java.lang.String fileName, java.io.File file, java.lang.String contentType, java.lang.String charset)
          FilePart Constructor.
 
Method Summary
protected  PartSource getSource()
          Returns the source of the file part.
protected  long lengthOfData()
          Return the length of the data.
protected  void sendData(java.io.OutputStream out)
          Write the data in "source" to the specified stream.
protected  void sendDispositionHeader(java.io.OutputStream out)
          Write the disposition header to the output stream
 
Methods inherited from class org.apache.commons.httpclient.methods.multipart.PartBase
getCharSet, getContentType, getName, getTransferEncoding, setCharSet, setContentType, setName, setTransferEncoding
 
Methods inherited from class org.apache.commons.httpclient.methods.multipart.Part
getBoundary, getLengthOfParts, getLengthOfParts, getPartBoundary, isRepeatable, length, send, sendContentTypeHeader, sendEnd, sendEndOfHeader, sendParts, sendParts, sendStart, sendTransferEncodingHeader, setPartBoundary, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_CONTENT_TYPE

public static final java.lang.String DEFAULT_CONTENT_TYPE
Default content encoding of file attachments.

See Also:
Constant Field Values

DEFAULT_CHARSET

public static final java.lang.String DEFAULT_CHARSET
Default charset of file attachments.

See Also:
Constant Field Values

DEFAULT_TRANSFER_ENCODING

public static final java.lang.String DEFAULT_TRANSFER_ENCODING
Default transfer encoding of file attachments.

See Also:
Constant Field Values

LOG

private static final org.apache.commons.logging.Log LOG
Log object for this class.


FILE_NAME

protected static final java.lang.String FILE_NAME
Attachment's file name

See Also:
Constant Field Values

FILE_NAME_BYTES

protected static final byte[] FILE_NAME_BYTES
Attachment's file name as a byte array


source

private PartSource source
Source of the file part.

Constructor Detail

FilePart

public FilePart(java.lang.String name,
                PartSource partSource,
                java.lang.String contentType,
                java.lang.String charset)
FilePart Constructor.


FilePart

public FilePart(java.lang.String name,
                PartSource partSource)
FilePart Constructor.


FilePart

public FilePart(java.lang.String name,
                java.io.File file)
         throws java.io.FileNotFoundException
FilePart Constructor.


FilePart

public FilePart(java.lang.String name,
                java.io.File file,
                java.lang.String contentType,
                java.lang.String charset)
         throws java.io.FileNotFoundException
FilePart Constructor.


FilePart

public FilePart(java.lang.String name,
                java.lang.String fileName,
                java.io.File file)
         throws java.io.FileNotFoundException
FilePart Constructor.


FilePart

public FilePart(java.lang.String name,
                java.lang.String fileName,
                java.io.File file,
                java.lang.String contentType,
                java.lang.String charset)
         throws java.io.FileNotFoundException
FilePart Constructor.

Method Detail

sendDispositionHeader

protected void sendDispositionHeader(java.io.OutputStream out)
                              throws java.io.IOException
Write the disposition header to the output stream

Overrides:
sendDispositionHeader in class Part

sendData

protected void sendData(java.io.OutputStream out)
                 throws java.io.IOException
Write the data in "source" to the specified stream.

Specified by:
sendData in class Part

getSource

protected PartSource getSource()
Returns the source of the file part.


lengthOfData

protected long lengthOfData()
                     throws java.io.IOException
Return the length of the data.

Specified by:
lengthOfData in class Part