Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mule.transport.http.multipart
Class MultiPartInputStream.MultiPart

    java.lang.Object
      org.mule.transport.http.multipart.MultiPartInputStream.MultiPart

All Implemented Interfaces:
  Part

Enclosing class:
  MultiPartInputStream

    public class MultiPartInputStream.MultiPart

extends Object
implements Part

Field Summary
`protected String` | `_contentType`
`protected File` | `_file`
`protected String` | `_filename`
`protected MultiMap<String>` | `_headers`
`protected String` | `_name`
`protected OutputStream` | `_out`
`protected long` | `_size`

Constructor Summary
`MultiPartInputStream.MultiPart(String name, String filename)`

Method Summary
`protected void` | `close()`
`protected void` | `createFile()`
`void` | `delete()` Deletes the underlying storage for a file item, including deleting any associated temporary disk file.
`String` | `getContentDispositionFilename()` Get the filename from the content-disposition.
`String` | `getContentType()` Gets the content type of this part.
`File` | `getFile()` Get the file, if any, the data has been written to.
`String` | `getHeader(String name)` Returns the value of the specified mime header as a `String`.
`Collection<String>` | `getHeaderNames()` Gets the header names of this Part.
`Collection<String>` | `getHeaders(String name)` Gets the values of the Part header with the given name.
`InputStream` | `getInputStream()` Gets the content of this part as an `InputStream`
`String` | `getName()` Gets the name of this part
`long` | `getSize()` Returns the size of this file.
`protected void` | `open()`
`protected void` | `setContentType(String contentType)`
`protected void` | `setHeaders(MultiMap<String> headers)`
`protected void` | `write(byte[] bytes, int offset, int length)`
`protected void` | `write(int b)`
`void` | `write(String fileName)` A convenience method to write this uploaded item to disk.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### _name

    protected String _name

### _filename

    protected String _filename

### _file

    protected File _file

### _out

    protected OutputStream _out

### _contentType

    protected String _contentType

### _headers

    protected MultiMap<String> _headers

### _size

    protected long _size

Constructor Detail

### MultiPartInputStream.MultiPart

    public MultiPartInputStream.MultiPart(String name,
                                          String filename)
                                   throws IOException

Throws:
  `IOException`

Method Detail

### setContentType

    protected void setContentType(String contentType)

### open

    protected void open()
                 throws FileNotFoundException,
                        IOException

  Throws:
    `FileNotFoundException`
    `IOException`

### close

    protected void close()
                  throws IOException

  Throws:
    `IOException`

### write

    protected void write(int b)
                  throws IOException

  Throws:
    `IOException`

### write

    protected void write(byte[] bytes,
                         int offset,
                         int length)
                  throws IOException

  Throws:
    `IOException`

### createFile

    protected void createFile()
                       throws IOException

  Throws:
    `IOException`

### setHeaders

    protected void setHeaders(MultiMap<String> headers)

### getContentType

    public String getContentType()

  Description copied from interface: `Part`
  Gets the content type of this part.

  Specified by:
    `getContentType` in interface `Part`
  Returns:
    The content type of this part.
  See Also:
    `Part.getContentType()`

### getHeader

    public String getHeader(String name)

  Description copied from interface: `Part`
  Returns the value of the specified mime header as a `String`. If the Part did not include a header of the specified name, this method returns `null`. If there are multiple headers with the same name, this method returns the first header in the part. The header name is case insensitive. You can use this method with any request header.

  Specified by:
    `getHeader` in interface `Part`
  Parameters:
    `name` - a `String` specifying the header name
  Returns:
    a `String` containing the value of the requested header, or `null` if the part does not have a header of that name
  See Also:
    `Part.getHeader(java.lang.String)`

### getHeaderNames

    public Collection<String> getHeaderNames()

  Description copied from interface: `Part`
  Gets the header names of this Part.

  Some servlet containers do not allow servlets to access headers using this method, in which case this method returns `null`

  Any changes to the returned `Collection` must not affect this `Part`.

  Specified by:
    `getHeaderNames` in interface `Part`
  Returns:
    a (possibly empty) `Collection` of the header names of this Part
  See Also:
    `Part.getHeaderNames()`

### getHeaders

    public Collection<String> getHeaders(String name)

  Description copied from interface: `Part`
  Gets the values of the Part header with the given name.

  Any changes to the returned `Collection` must not affect this `Part`.

  Part header names are case insensitive.

  Specified by:
    `getHeaders` in interface `Part`
  Parameters:
    `name` - the header name whose values to return
  Returns:
    a (possibly empty) `Collection` of the values of the header with the given name
  See Also:
    `Part.getHeaders(java.lang.String)`

### getInputStream

    public InputStream getInputStream()
                               throws IOException

  Description copied from interface: `Part`
  Gets the content of this part as an `InputStream`

  Specified by:
    `getInputStream` in interface `Part`
  Returns:
    The content of this part as an `InputStream`
  Throws:
    `IOException` - If an error occurs in retrieving the content as an `InputStream`
  See Also:
    `Part.getInputStream()`

### getName

    public String getName()

  Description copied from interface: `Part`
  Gets the name of this part

  Specified by:
    `getName` in interface `Part`
  Returns:
    The name of this part as a `String`
  See Also:
    `Part.getName()`

### getSize

    public long getSize()

  Description copied from interface: `Part`
  Returns the size of this file.

  Specified by:
    `getSize` in interface `Part`
  Returns:
    a `long` specifying the size of this part, in bytes.
  See Also:
    `Part.getSize()`

### write

    public void write(String fileName)
               throws IOException

  Description copied from interface: `Part`
  A convenience method to write this uploaded item to disk.

  This method is not guaranteed to succeed if called more than once for the same part. This allows a particular implementation to use, for example, file renaming, where possible, rather than copying all of the underlying data, thus gaining a significant performance benefit.

  Specified by:
    `write` in interface `Part`
  Parameters:
    `fileName` - the name of the file to which the stream will be written. The file is created relative to the location as specified in the MultipartConfig
  Throws:
    `IOException` - if an error occurs.
  See Also:
    `Part.write(java.lang.String)`

### delete

    public void delete()
                throws IOException

  Description copied from interface: `Part`
  Deletes the underlying storage for a file item, including deleting any associated temporary disk file.

  Specified by:
    `delete` in interface `Part`
  Throws:
    `IOException` - if an error occurs.
  See Also:
    `Part.delete()`

### getFile

    public File getFile()

  Get the file, if any, the data has been written to.

  Returns:

### getContentDispositionFilename

    public String getContentDispositionFilename()

  Get the filename from the content-disposition.

  Returns:
    null or the filename

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.