Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.commons.httpclient.methods.multipart
Class ByteArrayPartSource  view ByteArrayPartSource download ByteArrayPartSource.java

java.lang.Object
  extended byorg.apache.commons.httpclient.methods.multipart.ByteArrayPartSource
All Implemented Interfaces:
PartSource

public class ByteArrayPartSource
extends java.lang.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.

Since:
2.0

Field Summary
private  byte[] bytes
          Byte array of the source file.
private  java.lang.String fileName
          Name of the source file.
 
Constructor Summary
ByteArrayPartSource(java.lang.String fileName, byte[] bytes)
          Constructor for ByteArrayPartSource.
 
Method Summary
 java.io.InputStream createInputStream()
          Gets a new InputStream for reading this source.
 java.lang.String getFileName()
          Gets the name of the file this source represents.
 long getLength()
          Gets the number of bytes contained in this source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fileName

private java.lang.String fileName
Name of the source file.


bytes

private byte[] bytes
Byte array of the source file.

Constructor Detail

ByteArrayPartSource

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

Method Detail

getLength

public long getLength()
Description copied from interface: PartSource
Gets the number of bytes contained in this source.

Specified by:
getLength in interface PartSource

getFileName

public java.lang.String getFileName()
Description copied from interface: PartSource
Gets the name of the file this source represents.

Specified by:
getFileName in interface PartSource

createInputStream

public java.io.InputStream createInputStream()
                                      throws java.io.IOException
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 interface PartSource