Package org.eclipse.jetty.http
Class MultiPartFormInputStream.MultiPart
- java.lang.Object
-
- org.eclipse.jetty.http.MultiPartFormInputStream.MultiPart
-
- All Implemented Interfaces:
Part
- Enclosing class:
- MultiPartFormInputStream
public class MultiPartFormInputStream.MultiPart extends Object implements Part
-
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.jetty.util.ByteArrayOutputStream2_boutprotected String_contentTypeprotected File_fileprotected String_filenameprotected org.eclipse.jetty.util.MultiMap<String>_headersprotected String_nameprotected OutputStream_outprotected long_sizeprotected boolean_temporary
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanUp()Only remove tmp files.protected voidclose()protected voidcreateFile()voiddelete()Remove the file, whether or not Part.write() was called on it (ie no longer temporary)byte[]getBytes()StringgetContentDispositionFilename()Get the filename from the content-disposition.StringgetContentType()FilegetFile()Get the fileStringgetHeader(String name)Collection<String>getHeaderNames()Collection<String>getHeaders(String name)InputStreamgetInputStream()StringgetName()longgetSize()StringgetSubmittedFileName()protected voidopen()protected voidsetContentType(String contentType)protected voidsetHeaders(org.eclipse.jetty.util.MultiMap<String> headers)StringtoString()protected voidwrite(byte[] bytes, int offset, int length)protected voidwrite(int b)voidwrite(String fileName)
-
-
-
Field Detail
-
_name
protected String _name
-
_filename
protected String _filename
-
_file
protected File _file
-
_out
protected OutputStream _out
-
_bout
protected org.eclipse.jetty.util.ByteArrayOutputStream2 _bout
-
_contentType
protected String _contentType
-
_headers
protected org.eclipse.jetty.util.MultiMap<String> _headers
-
_size
protected long _size
-
_temporary
protected boolean _temporary
-
-
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(org.eclipse.jetty.util.MultiMap<String> headers)
-
getContentType
public String getContentType()
- Specified by:
getContentTypein interfacePart
-
getHeaderNames
public Collection<String> getHeaderNames()
- Specified by:
getHeaderNamesin interfacePart
-
getHeaders
public Collection<String> getHeaders(String name)
- Specified by:
getHeadersin interfacePart
-
getInputStream
public InputStream getInputStream() throws IOException
- Specified by:
getInputStreamin interfacePart- Throws:
IOException
-
getSubmittedFileName
public String getSubmittedFileName()
- Specified by:
getSubmittedFileNamein interfacePart
-
getBytes
public byte[] getBytes()
-
write
public void write(String fileName) throws IOException
- Specified by:
writein interfacePart- Throws:
IOException
-
delete
public void delete() throws IOExceptionRemove the file, whether or not Part.write() was called on it (ie no longer temporary)- Specified by:
deletein interfacePart- Throws:
IOException
-
cleanUp
public void cleanUp() throws IOExceptionOnly remove tmp files.- Throws:
IOException- if unable to delete the file
-
getFile
public File getFile()
Get the file- Returns:
- the file, if any, the data has been written to.
-
getContentDispositionFilename
public String getContentDispositionFilename()
Get the filename from the content-disposition.- Returns:
- null or the filename
-
-