SAP NetWeaver '04

com.sapportals.wcm.util.mmparser
Class FilePart

[contained in: com.sap.netweaver.bc.util.par - bc.util.public_api.jar]
java.lang.Object
  |
  +--com.sapportals.wcm.util.mmparser.AbstractPart
        |
        +--com.sapportals.wcm.util.mmparser.FilePart

public class FilePart
extends AbstractPart

A FilePart is an upload part which represents a INPUT TYPE="file" form parameter.


Method Summary
 java.lang.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.
 HeaderFields getHeader()
          
 java.io.InputStream getInputStream()
          Returns an input stream which contains the contents of the file supplied.
 boolean isFile()
          Returns true to indicate this part is a file.
 void setHeader(HeaderFields header)
          
protected  long write(java.io.OutputStream out)
          Internal method to write this file part; doesn't check to see if it has contents first.
 long writeTo(java.io.File fileOrDirectory)
          Write this file part to a file or directory.
 long writeTo(java.io.OutputStream out)
          Write this file part to the given output stream.
 
Methods inherited from class com.sapportals.wcm.util.mmparser.AbstractPart
getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFileName

public java.lang.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. Note: this is not the same as the name of the form parameter used to transmit the file; that is available from the getName method.
Returns:
name of file uploaded or null .

getHeader

public HeaderFields getHeader()
Returns:

setHeader

public void setHeader(HeaderFields header)
Parameters:
header -

getInputStream

public java.io.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:
an input stream containing contents of file.

writeTo

public long writeTo(java.io.File fileOrDirectory)
             throws java.io.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:
fileOrDirectory -
Returns:
number of bytes written
Throws:
java.io.IOException -

writeTo

public long writeTo(java.io.OutputStream out)
             throws java.io.IOException
Write this file part to the given output stream. If this part doesn't contain a file this method does nothing.
Parameters:
out -
Returns:
number of bytes written.
Throws:
java.io.IOException -

isFile

public boolean isFile()
Returns true to indicate this part is a file.
Overrides:
isFile in class AbstractPart
Returns:
true.

write

protected long write(java.io.OutputStream out)
              throws java.io.IOException
Internal method to write this file part; doesn't check to see if it has contents first.
Parameters:
out -
Returns:
number of bytes written.
Throws:
java.io.IOException - if an input or output exception has occurred.

SAP NetWeaver '04

Copyright © 2004 by SAP AG. All Rights Reserved.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.