org.eclipse.jetty.util
类 MultiPartInputStream.MultiPart

java.lang.Object
  继承者 org.eclipse.jetty.util.MultiPartInputStream.MultiPart
所有已实现的接口:
Part
包容类:
MultiPartInputStream

public class MultiPartInputStream.MultiPart
extends Object
implements Part


字段摘要
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
           
 
构造方法摘要
MultiPartInputStream.MultiPart(String name, String filename)
           
 
方法摘要
 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()
          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 fille.
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.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

_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
构造方法详细信息

MultiPartInputStream.MultiPart

public MultiPartInputStream.MultiPart(String name,
                                      String filename)
                               throws IOException
抛出:
IOException
方法详细信息

setContentType

protected void setContentType(String contentType)

open

protected void open()
             throws IOException
抛出:
IOException

close

protected void close()
              throws IOException
抛出:
IOException

write

protected void write(int b)
              throws IOException
抛出:
IOException

write

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

createFile

protected void createFile()
                   throws IOException
抛出:
IOException

setHeaders

protected void setHeaders(MultiMap<String> headers)

getContentType

public String getContentType()
从接口 Part 复制的描述
Gets the content type of this part.

指定者:
接口 Part 中的 getContentType
返回:
The content type of this part.
另请参见:
Part.getContentType()

getHeader

public String getHeader(String name)
从接口 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.

指定者:
接口 Part 中的 getHeader
参数:
name - a String specifying the header name
返回:
a String containing the value of the requested header, or null if the part does not have a header of that name
另请参见:
Part.getHeader(java.lang.String)

getHeaderNames

public Collection<String> getHeaderNames()
从接口 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.

指定者:
接口 Part 中的 getHeaderNames
返回:
a (possibly empty) Collection of the header names of this Part
另请参见:
Part.getHeaderNames()

getHeaders

public Collection<String> getHeaders(String name)
从接口 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.

指定者:
接口 Part 中的 getHeaders
参数:
name - the header name whose values to return
返回:
a (possibly empty) Collection of the values of the header with the given name
另请参见:
Part.getHeaders(java.lang.String)

getInputStream

public InputStream getInputStream()
                           throws IOException
从接口 Part 复制的描述
Gets the content of this part as an InputStream

指定者:
接口 Part 中的 getInputStream
返回:
The content of this part as an InputStream
抛出:
IOException - If an error occurs in retrieving the contet as an InputStream
另请参见:
Part.getInputStream()

getBytes

public byte[] getBytes()

getName

public String getName()
从接口 Part 复制的描述
Gets the name of this part

指定者:
接口 Part 中的 getName
返回:
The name of this part as a String
另请参见:
Part.getName()

getSize

public long getSize()
从接口 Part 复制的描述
Returns the size of this fille.

指定者:
接口 Part 中的 getSize
返回:
a long specifying the size of this part, in bytes.
另请参见:
Part.getSize()

write

public void write(String fileName)
           throws IOException
从接口 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.

指定者:
接口 Part 中的 write
参数:
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
抛出:
IOException - if an error occurs.
另请参见:
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)

指定者:
接口 Part 中的 delete
抛出:
IOException - if an error occurs.
另请参见:
Part.delete()

cleanUp

public void cleanUp()
             throws IOException
Only remove tmp files.

抛出:
IOException

getFile

public File getFile()
Get the file, if any, the data has been written to.

返回:

getContentDispositionFilename

public String getContentDispositionFilename()
Get the filename from the content-disposition.

返回:
null or the filename


Copyright © 2013. All Rights Reserved.