Package org.eclipse.jetty.util
Class MultiPartInputStreamParser.MultiPart
- java.lang.Object
-
- org.eclipse.jetty.util.MultiPartInputStreamParser.MultiPart
-
- All Implemented Interfaces:
Part
- Enclosing class:
- MultiPartInputStreamParser
public class MultiPartInputStreamParser.MultiPart extends Object implements Part
-
-
Field Summary
Fields Modifier and Type Field Description protected ByteArrayOutputStream2_boutprotected String_contentTypeprotected File_fileprotected String_filenameprotected 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(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 ByteArrayOutputStream2 _bout
-
_contentType
protected String _contentType
-
_size
protected long _size
-
_temporary
protected boolean _temporary
-
-
Constructor Detail
-
MultiPart
public 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
-
getContentType
public String getContentType()
- Specified by:
getContentTypein interfacePart- See Also:
Part.getContentType()
-
getHeader
public String getHeader(String name)
- Specified by:
getHeaderin interfacePart- See Also:
Part.getHeader(java.lang.String)
-
getHeaderNames
public Collection<String> getHeaderNames()
- Specified by:
getHeaderNamesin interfacePart- See Also:
Part.getHeaderNames()
-
getHeaders
public Collection<String> getHeaders(String name)
- Specified by:
getHeadersin interfacePart- See Also:
Part.getHeaders(java.lang.String)
-
getInputStream
public InputStream getInputStream() throws IOException
- Specified by:
getInputStreamin interfacePart- Throws:
IOException- See Also:
Part.getInputStream()
-
getSubmittedFileName
public String getSubmittedFileName()
- Specified by:
getSubmittedFileNamein interfacePart- See Also:
Part.getSubmittedFileName()
-
getBytes
public byte[] getBytes()
-
getName
public String getName()
- Specified by:
getNamein interfacePart- See Also:
Part.getName()
-
getSize
public long getSize()
- Specified by:
getSizein interfacePart- See Also:
Part.getSize()
-
write
public void write(String fileName) throws IOException
- Specified by:
writein interfacePart- Throws:
IOException- See Also:
Part.write(java.lang.String)
-
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- See Also:
Part.delete()
-
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
-
-