org.apache.commons.httpclient.methods.multipart

Class ByteArrayPartSource

Implemented Interfaces:
PartSource

public class ByteArrayPartSource
extends Object
implements PartSource

A PartSource that reads from a byte array. This class should be used when the data to post is already loaded into memory.

Author:
Michael Becke

Since:
2.0

Constructor Summary

ByteArrayPartSource(String fileName, byte[] bytes)
Constructor for ByteArrayPartSource.

Method Summary

InputStream
createInputStream()
String
getFileName()
long
getLength()

Constructor Details

ByteArrayPartSource

public ByteArrayPartSource(String fileName,
                           byte[] bytes)
Constructor for ByteArrayPartSource.

Parameters:
fileName - the name of the file these bytes represent
bytes - the content of this part

Method Details

createInputStream

public InputStream createInputStream()
            throws IOException
Specified by:
createInputStream in interface PartSource

See Also:
PartSource.createInputStream()


getFileName

public String getFileName()
Specified by:
getFileName in interface PartSource

See Also:
PartSource.getFileName()


getLength

public long getLength()
Specified by:
getLength in interface PartSource

See Also:
PartSource.getLength()


Copyright (c) 1999-2005 - Apache Software Foundation