org.apache.commons.httpclient.methods.multipart

Class FilePartSource

public class FilePartSource extends Object implements PartSource

A PartSource that reads from a File.

Since: 2.0

Author: Michael Becke Mark Diggory Mike Bowler

Constructor Summary
FilePartSource(File file)
Constructor for FilePartSource.
FilePartSource(String fileName, File file)
Constructor for FilePartSource.
Method Summary
InputStreamcreateInputStream()
Return a new {@link FileInputStream} for the current filename.
StringgetFileName()
Return the current filename
longgetLength()
Return the length of the file

Constructor Detail

FilePartSource

public FilePartSource(File file)
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)
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

createInputStream

public InputStream createInputStream()
Return a new {@link FileInputStream} for the current filename.

Returns: the new input stream.

Throws: IOException If an IO problem occurs.

See Also: createInputStream

getFileName

public String getFileName()
Return the current filename

Returns: the filename.

See Also: getFileName

getLength

public long getLength()
Return the length of the file

Returns: the length of the file.

See Also: getLength

Copyright (c) 1999-2005 - Apache Software Foundation