Class ByteArrayPartSource
java.lang.Object
edu.internet2.middleware.grouperClientExt.org.apache.commons.httpclient.methods.multipart.ByteArrayPartSource
- All Implemented Interfaces:
PartSource
A PartSource that reads from a byte array. This class should be used when
the data to post is already loaded into memory.
- Since:
- 2.0
-
Constructor Summary
ConstructorDescriptionByteArrayPartSource
(String fileName, byte[] bytes) Constructor for ByteArrayPartSource. -
Method Summary
Modifier and TypeMethodDescriptionGets a new InputStream for reading this source.Gets the name of the file this source represents.long
Gets the number of bytes contained in this source.
-
Constructor Details
-
ByteArrayPartSource
Constructor for ByteArrayPartSource.- Parameters:
fileName
- the name of the file these bytes representbytes
- the content of this part
-
-
Method Details
-
getLength
public long getLength()Description copied from interface:PartSource
Gets the number of bytes contained in this source.- Specified by:
getLength
in interfacePartSource
- Returns:
- a value >= 0
- See Also:
-
getFileName
Description copied from interface:PartSource
Gets the name of the file this source represents.- Specified by:
getFileName
in interfacePartSource
- Returns:
- the fileName used for posting a MultiPart file part
- See Also:
-
createInputStream
Description copied from interface:PartSource
Gets a new InputStream for reading this source. This method can be called more than once and should therefore return a new stream every time.- Specified by:
createInputStream
in interfacePartSource
- Returns:
- a new InputStream
- Throws:
IOException
- if an error occurs when creating the InputStream- See Also:
-