Package org.eclipse.jetty.util
Class MultiPartInputStreamParser.MultiPart
- java.lang.Object
-
- org.eclipse.jetty.util.MultiPartInputStreamParser.MultiPart
-
- All Implemented Interfaces:
javax.servlet.http.Part
- Enclosing class:
- MultiPartInputStreamParser
public class MultiPartInputStreamParser.MultiPart extends java.lang.Object implements javax.servlet.http.Part
-
-
Field Summary
Fields Modifier and Type Field Description protected ByteArrayOutputStream2
_bout
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
protected boolean
_temporary
-
Constructor Summary
Constructors Constructor Description MultiPart(java.lang.String name, java.lang.String filename)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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()
java.lang.String
getContentDispositionFilename()
Get the filename from the content-disposition.java.lang.String
getContentType()
java.io.File
getFile()
Get the filejava.lang.String
getHeader(java.lang.String name)
java.util.Collection<java.lang.String>
getHeaderNames()
java.util.Collection<java.lang.String>
getHeaders(java.lang.String name)
java.io.InputStream
getInputStream()
java.lang.String
getName()
long
getSize()
java.lang.String
getSubmittedFileName()
protected void
open()
protected void
setContentType(java.lang.String contentType)
protected void
setHeaders(MultiMap<java.lang.String> headers)
java.lang.String
toString()
protected void
write(byte[] bytes, int offset, int length)
protected void
write(int b)
void
write(java.lang.String fileName)
-
-
-
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
-
_bout
protected ByteArrayOutputStream2 _bout
-
_contentType
protected java.lang.String _contentType
-
_headers
protected MultiMap<java.lang.String> _headers
-
_size
protected long _size
-
_temporary
protected boolean _temporary
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
setContentType
protected void setContentType(java.lang.String contentType)
-
open
protected void open() throws java.io.IOException
- Throws:
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
- Throws:
java.io.IOException
-
write
protected void write(byte[] bytes, int offset, int length) throws java.io.IOException
- Throws:
java.io.IOException
-
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()
- Specified by:
getContentType
in interfacejavax.servlet.http.Part
- See Also:
Part.getContentType()
-
getHeader
public java.lang.String getHeader(java.lang.String name)
- Specified by:
getHeader
in interfacejavax.servlet.http.Part
- See Also:
Part.getHeader(java.lang.String)
-
getHeaderNames
public java.util.Collection<java.lang.String> getHeaderNames()
- Specified by:
getHeaderNames
in interfacejavax.servlet.http.Part
- See Also:
Part.getHeaderNames()
-
getHeaders
public java.util.Collection<java.lang.String> getHeaders(java.lang.String name)
- Specified by:
getHeaders
in interfacejavax.servlet.http.Part
- See Also:
Part.getHeaders(java.lang.String)
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException
- Specified by:
getInputStream
in interfacejavax.servlet.http.Part
- Throws:
java.io.IOException
- See Also:
Part.getInputStream()
-
getSubmittedFileName
public java.lang.String getSubmittedFileName()
- Specified by:
getSubmittedFileName
in interfacejavax.servlet.http.Part
- See Also:
Part.getSubmittedFileName()
-
getBytes
public byte[] getBytes()
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfacejavax.servlet.http.Part
- See Also:
Part.getName()
-
getSize
public long getSize()
- Specified by:
getSize
in interfacejavax.servlet.http.Part
- See Also:
Part.getSize()
-
write
public void write(java.lang.String fileName) throws java.io.IOException
- Specified by:
write
in interfacejavax.servlet.http.Part
- Throws:
java.io.IOException
- See Also:
Part.write(java.lang.String)
-
delete
public void delete() throws java.io.IOException
Remove the file, whether or not Part.write() was called on it (ie no longer temporary)- Specified by:
delete
in interfacejavax.servlet.http.Part
- Throws:
java.io.IOException
- See Also:
Part.delete()
-
cleanUp
public void cleanUp() throws java.io.IOException
Only remove tmp files.- Throws:
java.io.IOException
- if unable to delete the file
-
getFile
public java.io.File getFile()
Get the file- Returns:
- the file, if any, the data has been written to.
-
getContentDispositionFilename
public java.lang.String getContentDispositionFilename()
Get the filename from the content-disposition.- Returns:
- null or the filename
-
-