com.wewebu.ow.server.util.upload
Class OwMultiPart

java.lang.Object
  extended by com.wewebu.ow.server.util.upload.OwMultiPart

public class OwMultiPart
extends Object

A FilePart is an upload part, which represents an input type = "file" form parameter.

Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.

For licensing information read the license.txt file or
go to: http://wiki.alfresco.com


Constructor Summary
OwMultiPart(String name_p, javax.servlet.ServletInputStream in_p, String boundary_p, String contentType_p, String fileName_p, String filePath_p)
          Construct a file part
 
Method Summary
 String getContentType()
          Returns the content type of the file data contained within.
 String getFileName()
          Returns the name that the file was stored with on the remote system, or null if the user didn't enter a file to be uploaded.
 String getFilePath()
          Returns the full path and name of the file on the remote system, or null if the user didn't enter a file to be uploaded.
 InputStream getInputStream()
          Returns an input stream which contains the contents of the file supplied.
 String getName()
          Returns the name of the form element that this Part corresponds to.
 boolean isFile()
          Returns true if this Part is a FilePart.
 long writeTo(File fileOrDirectory_p, String fileName_p)
          Write this file part to a file or directory.
 long writeTo(OutputStream out_p)
          Write this file part to the given output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OwMultiPart

public OwMultiPart(String name_p,
                   javax.servlet.ServletInputStream in_p,
                   String boundary_p,
                   String contentType_p,
                   String fileName_p,
                   String filePath_p)
            throws IOException
Construct a file part

Parameters:
name_p - String - the name of the parameter.
in_p - ServletInputStream - the servlet input stream to read the file from.
boundary_p - String - the MIME boundary that delimits the end of file.
contentType_p - String - the content type of the file provided in the MIME header.
fileName_p - String - the file system name of the file provided in the MIME header.
filePath_p - String - the file system path of the file provided in the MIME header (as specified in disposition info).
Throws:
IOException - if an input or output exception has occurred.
Method Detail

getName

public String getName()
Returns the name of the form element that this Part corresponds to.

Returns:
java.lang.String Name of the form element that this Part corresponds to.

getFileName

public String getFileName()
Returns the name that the file was stored with on the remote system, or null if the user didn't enter a file to be uploaded.

Returns:
String m_filename Name of the file uploaded or null.

getFilePath

public String getFilePath()
Returns the full path and name of the file on the remote system, or null if the user didn't enter a file to be uploaded.

Returns:
String m_filePath Path of the file uploaded or null.

getContentType

public String getContentType()
Returns the content type of the file data contained within.

Returns:
String m_contentType content type of the file data contained within.

getInputStream

public InputStream getInputStream()
Returns an input stream which contains the contents of the file supplied. If the user didn't enter a file to upload there will be 0 bytes in the input stream.

Returns:
String m_partInput input stream containing contents of file.

writeTo

public long writeTo(File fileOrDirectory_p,
                    String fileName_p)
             throws IOException
Write this file part to a file or directory. If the user supplied a file, we write it to that file, and if they supplied a directory, we write it to that directory with the filename that accompanied it. If this part doesn't contain a file this method does nothing.

Parameters:
fileName_p - name of the uploaded file
fileOrDirectory_p - File/Dir to which data will be written
Returns:
long number of bytes written.
Throws:
IOException - if an input or output exception is occurred.

writeTo

public long writeTo(OutputStream out_p)
             throws IOException
Write this file part to the given output stream. If this part doesn't contain a file this method does nothing.

Parameters:
out_p - OutputStream to which data will be written
Returns:
long number of bytes written.
Throws:
IOException - if an input or output exception is occurred.

isFile

public boolean isFile()
Returns true if this Part is a FilePart.

Returns:
boolean true if this is a FilePart.


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.