org.eclipse.jetty.util

## Class MultiPartInputStream.MultiPart

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

- All Implemented Interfaces:
    javax.servlet.http.Part
  Enclosing class:
    MultiPartInputStream

      public class MultiPartInputStream.MultiPart
      extends Object
      implements javax.servlet.http.Part

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ByteArrayOutputStream2` | `_bout`
    `protected String` | `_contentType`
    `protected File` | `_file`
    `protected String` | `_filename`
    `protected MultiMap<String>` | `_headers`
    `protected String` | `_name`
    `protected OutputStream` | `_out`
    `protected long` | `_size`
    `protected boolean` | `_temporary`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MultiPartInputStream.MultiPart(String name, String filename)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cleanUp()` Only remove tmp files.
    `protected void` | `close()`
    `protected void` | `createFile()`
    `void` | `delete()` Remove the file, whether or not Part.write() was called on it (ie no longer temporary)
    `byte[]` | `getBytes()`
    `String` | `getContentDispositionFilename()` Get the filename from the content-disposition.
    `String` | `getContentType()`
    `File` | `getFile()` Get the file, if any, the data has been written to.
    `String` | `getHeader(String name)`
    `Collection<String>` | `getHeaderNames()`
    `Collection<String>` | `getHeaders(String name)`
    `InputStream` | `getInputStream()`
    `String` | `getName()`
    `long` | `getSize()`
    `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)`

    - ### 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

    - #### _bout

          protected ByteArrayOutputStream2 _bout

    - #### _contentType

          protected String _contentType

    - #### _headers

          protected MultiMap<String> _headers

    - #### _size

          protected long _size

    - #### _temporary

          protected boolean _temporary

  - ### 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 IOException

      Throws:
        `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()

      Specified by:
        `getContentType` in interface `javax.servlet.http.Part`
      See Also:
        `Part.getContentType()`

    - #### getHeader

          public String getHeader(String name)

      Specified by:
        `getHeader` in interface `javax.servlet.http.Part`
      See Also:
        `Part.getHeader(java.lang.String)`

    - #### getHeaderNames

          public Collection<String> getHeaderNames()

      Specified by:
        `getHeaderNames` in interface `javax.servlet.http.Part`
      See Also:
        `Part.getHeaderNames()`

    - #### getHeaders

          public Collection<String> getHeaders(String name)

      Specified by:
        `getHeaders` in interface `javax.servlet.http.Part`
      See Also:
        `Part.getHeaders(java.lang.String)`

    - #### getInputStream

          public InputStream getInputStream()
                                     throws IOException

      Specified by:
        `getInputStream` in interface `javax.servlet.http.Part`
      Throws:
        `IOException`
      See Also:
        `Part.getInputStream()`

    - #### getBytes

          public byte[] getBytes()

    - #### getName

          public String getName()

      Specified by:
        `getName` in interface `javax.servlet.http.Part`
      See Also:
        `Part.getName()`

    - #### getSize

          public long getSize()

      Specified by:
        `getSize` in interface `javax.servlet.http.Part`
      See Also:
        `Part.getSize()`

    - #### write

          public void write(String fileName)
                     throws IOException

      Specified by:
        `write` in interface `javax.servlet.http.Part`
      Throws:
        `IOException`
      See Also:
        `Part.write(java.lang.String)`

    - #### delete

          public void delete()
                      throws IOException

      Remove the file, whether or not Part.write() was called on it (ie no longer temporary)
      Specified by:
        `delete` in interface `javax.servlet.http.Part`
      Throws:
        `IOException`
      See Also:
        `Part.delete()`

    - #### cleanUp

          public void cleanUp()
                       throws IOException

      Only remove tmp files.
      Throws:
        `IOException`

    - #### 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

Copyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.