org.apache.commons.httpclient.methods.multipart
Class FilePart

java.lang.Object
  |
  +--org.apache.commons.httpclient.methods.multipart.Part
        |
        +--org.apache.commons.httpclient.methods.multipart.FilePart

public class FilePart
extends Part

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

Since:
2.0
Author:
Matthew Albright, Jeff Dever, Adrian Sutton, Michael Becke, Mark Diggory

Constructor Summary
FilePart(java.lang.String name, java.io.File file)
          FilePart Constructor.
FilePart(java.lang.String name, PartSource partSource)
          FilePart Constructor.
FilePart(java.lang.String name, java.lang.String fileName, java.io.File file)
          FilePart Constructor.
 
Method Summary
 java.lang.String getName()
           
protected  long lengthOfData()
           
protected  void sendContentType(java.io.OutputStream out)
           
protected  void sendData(java.io.OutputStream out)
           
protected  void sendFilename(java.io.OutputStream out)
           
protected  void sendHeader(java.io.OutputStream out)
           
 
Methods inherited from class org.apache.commons.httpclient.methods.multipart.Part
getBoundary, length, lengthOfEnd, lengthOfEndOfHeader, lengthOfHeader, lengthOfLastBoundary, lengthOfStart, send, sendEnd, sendEndOfHeader, sendLastBoundary, sendStart, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FilePart

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

Parameters:
name - the name of the file part
file - the file to post
Throws:
java.io.FileNotFoundException - if the file is not a normal file or if it is not readable.

FilePart

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

Parameters:
name - the name of the file part
fileName - the file name
file - the file to post
Throws:
java.io.FileNotFoundException - if the file is not a normal file or if it is not readable.

FilePart

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

Parameters:
name - the name for this part
partSource - the source for this part
Method Detail

sendHeader

protected void sendHeader(java.io.OutputStream out)
                   throws java.io.IOException
Overrides:
sendHeader in class Part
java.io.IOException

sendFilename

protected void sendFilename(java.io.OutputStream out)
                     throws java.io.IOException
java.io.IOException

sendContentType

protected void sendContentType(java.io.OutputStream out)
                        throws java.io.IOException
java.io.IOException

getName

public java.lang.String getName()
Specified by:
getName in class Part

sendData

protected void sendData(java.io.OutputStream out)
                 throws java.io.IOException
Specified by:
sendData in class Part
java.io.IOException

lengthOfData

protected long lengthOfData()
                     throws java.io.IOException
Specified by:
lengthOfData in class Part
java.io.IOException


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