org.sakaiproject.util
Class FileItem

java.lang.Object
  extended by org.sakaiproject.util.FileItem

public class FileItem
extends Object

FileItem is ...


Field Summary
protected  ByteArrayOutputStream m_body
          Body stored in memory, filled in using this stream.
protected  byte[] m_bodyBytes
           
protected  InputStream m_inputStream
          Stream from which body can be read
protected  String m_name
          file name.
protected  String m_type
          file type.
protected static int STREAM_BUFFER_SIZE
          The chunk size used when streaming (100k).
 
Constructor Summary
FileItem(String fileName, String fileType)
          Construct
FileItem(String fileName, String fileType, byte[] body)
           
FileItem(String fileName, String fileType, InputStream stream)
           
 
Method Summary
 byte[] get()
          Access the body as a byte array.
 String getContentType()
           
 String getFileName()
           
 InputStream getInputStream()
          Access the input stream from which the body can be read.
 String getString()
          Access the body as a String.
protected  void stream2bodyBytes()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STREAM_BUFFER_SIZE

protected static final int STREAM_BUFFER_SIZE
The chunk size used when streaming (100k).

See Also:
Constant Field Values

m_body

protected ByteArrayOutputStream m_body
Body stored in memory, filled in using this stream.


m_bodyBytes

protected byte[] m_bodyBytes

m_name

protected String m_name
file name.


m_type

protected String m_type
file type.


m_inputStream

protected InputStream m_inputStream
Stream from which body can be read

Constructor Detail

FileItem

public FileItem(String fileName,
                String fileType)
Construct

Parameters:
fileName - The file name.
fileType - The file type.

FileItem

public FileItem(String fileName,
                String fileType,
                byte[] body)

FileItem

public FileItem(String fileName,
                String fileType,
                InputStream stream)
Method Detail

getFileName

public String getFileName()

getContentType

public String getContentType()

getString

public String getString()
Access the body as a String.


get

public byte[] get()
Access the body as a byte array. This consumes the entry.


getInputStream

public InputStream getInputStream()
Access the input stream from which the body can be read.

Returns:

stream2bodyBytes

protected void stream2bodyBytes()


Copyright © 2003-2013 The Sakai Foundation. All Rights Reserved.