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.eclipse.jetty.util
Class MultiPartInputStream.MultiPart

    java.lang.Object
      org.eclipse.jetty.util.MultiPartInputStream.MultiPart

All Implemented Interfaces:
  Part

Enclosing class:
  MultiPartInputStream

    public class MultiPartInputStream.MultiPart

extends java.lang.Object
implements Part

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

Constructor Summary
`MultiPartInputStream.MultiPart(java.lang.String name, java.lang.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.
`java.lang.String` | `getContentDispositionFilename()` Get the filename from the content-disposition.
`java.lang.String` | `getContentType()` Gets the content type of this part.
`java.io.File` | `getFile()` Get the file, if any, the data has been written to.
`java.lang.String` | `getHeader(java.lang.String name)` Returns the value of the specified mime header as a `String`.
`java.util.Collection<java.lang.String>` | `getHeaderNames()` Gets the header names of this Part.
`java.util.Collection<java.lang.String>` | `getHeaders(java.lang.String name)` Gets the values of the Part header with the given name.
`java.io.InputStream` | `getInputStream()` Gets the content of this part as an `InputStream`
`java.lang.String` | `getName()` Gets the name of this part
`long` | `getSize()` Returns the size of this fille.
`protected void` | `open()`
`protected void` | `setContentType(java.lang.String contentType)`
`protected void` | `setHeaders(MultiMap<java.lang.String> headers)`
`protected void` | `write(byte[] bytes, int offset, int length)`
`protected void` | `write(int b)`
`void` | `write(java.lang.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 java.lang.String _name

### _filename

    protected java.lang.String _filename

### _file

    protected java.io.File _file

### _out

    protected java.io.OutputStream _out

### _contentType

    protected java.lang.String _contentType

### _headers

    protected MultiMap<java.lang.String> _headers

### _size

    protected long _size

Constructor Detail

### MultiPartInputStream.MultiPart

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

Throws:
  `java.io.IOException`

Method Detail

### setContentType

    protected void setContentType(java.lang.String contentType)

### open

    protected void open()
                 throws java.io.FileNotFoundException,
                        java.io.IOException

  Throws:
    `java.io.FileNotFoundException`
    `java.io.IOException`

### close

    protected void close()
                  throws java.io.IOException

  Throws:
    `java.io.IOException`

### write

    protected void write(int b)
                  throws java.io.IOException,
                         ServletException

  Throws:
    `java.io.IOException`
    `ServletException`

### write

    protected void write(byte[] bytes,
                         int offset,
                         int length)
                  throws java.io.IOException,
                         ServletException

  Throws:
    `java.io.IOException`
    `ServletException`

### createFile

    protected void createFile()
                       throws java.io.IOException

  Throws:
    `java.io.IOException`

### setHeaders

    protected void setHeaders(MultiMap<java.lang.String> headers)

### getContentType

    public java.lang.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 java.lang.String getHeader(java.lang.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 java.util.Collection<java.lang.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 java.util.Collection<java.lang.String> getHeaders(java.lang.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 java.io.InputStream getInputStream()
                                       throws java.io.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:
    `java.io.IOException` - If an error occurs in retrieving the contet as an `InputStream`
  See Also:
    `Part.getInputStream()`

### getName

    public java.lang.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 fille.

  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(java.lang.String fileName)
               throws java.io.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:
    `java.io.IOException` - if an error occurs.
  See Also:
    `Part.write(java.lang.String)`

### delete

    public void delete()
                throws java.io.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:
    `java.io.IOException` - if an error occurs.
  See Also:
    `Part.delete()`

### getFile

    public java.io.File getFile()

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

  Returns:

### getContentDispositionFilename

    public java.lang.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 © 1995-2010 Mort Bay Consulting. All Rights Reserved.