com.ning.http.multipart
Class FilePartSource

java.lang.Object
  extended by com.ning.http.multipart.FilePartSource
All Implemented Interfaces:
PartSource

public class FilePartSource
extends Object
implements PartSource

This class is an adaptation of the Apache HttpClient implementation


Constructor Summary
FilePartSource(File file)
          Constructor for FilePartSource.
FilePartSource(String fileName, File file)
          Constructor for FilePartSource.
 
Method Summary
 InputStream createInputStream()
          Return a new FileInputStream for the current filename.
 File getFile()
           
 String getFileName()
          Return the current filename
 long getLength()
          Return the length of the file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilePartSource

public FilePartSource(File file)
               throws FileNotFoundException
Constructor for FilePartSource.

Parameters:
file - the FilePart source File.
Throws:
FileNotFoundException - if the file does not exist or cannot be read

FilePartSource

public FilePartSource(String fileName,
                      File file)
               throws FileNotFoundException
Constructor for FilePartSource.

Parameters:
fileName - the file name of the FilePart
file - the source File for the FilePart
Throws:
FileNotFoundException - if the file does not exist or cannot be read
Method Detail

getLength

public long getLength()
Return the length of the file

Specified by:
getLength in interface PartSource
Returns:
the length of the file.
See Also:
PartSource.getLength()

getFileName

public String getFileName()
Return the current filename

Specified by:
getFileName in interface PartSource
Returns:
the filename.
See Also:
PartSource.getFileName()

createInputStream

public InputStream createInputStream()
                              throws IOException
Return a new FileInputStream for the current filename.

Specified by:
createInputStream in interface PartSource
Returns:
the new input stream.
Throws:
IOException - If an IO problem occurs.
See Also:
PartSource.createInputStream()

getFile

public File getFile()


Copyright © 2011. All Rights Reserved.