Class MagicMimeTypeFileItem
java.lang.Object
org.hippoecm.frontend.plugins.yui.upload.MagicMimeTypeFileItem
- All Implemented Interfaces:
org.apache.commons.fileupload2.core.FileItem<MagicMimeTypeFileItem>
,org.apache.commons.fileupload2.core.FileItemHeadersProvider<MagicMimeTypeFileItem>
public class MagicMimeTypeFileItem
extends Object
implements org.apache.commons.fileupload2.core.FileItem<MagicMimeTypeFileItem>
A file item that resolves the mime-type using Apache Tika. It is named after content type detection based on
magic bytes, i.e. type-specific patterns near the beginning of the document input stream, see Tika's MagicDetector.
This class is a decorator for a
FileItem
. It also keeps track of the opening input/output streams to close
them when the temporary file is deleted.-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptiondelete()
byte[]
get()
org.apache.commons.fileupload2.core.FileItemHeaders
getName()
long
getSize()
boolean
boolean
setFieldName
(String name) setFormField
(boolean state) setHeaders
(org.apache.commons.fileupload2.core.FileItemHeaders headers)
-
Method Details
-
getContentType
- Specified by:
getContentType
in interfaceorg.apache.commons.fileupload2.core.FileItem<MagicMimeTypeFileItem>
-
getBrowserProvidedContentType
-
getInputStream
- Specified by:
getInputStream
in interfaceorg.apache.commons.fileupload2.core.FileItem<MagicMimeTypeFileItem>
- Throws:
IOException
-
getOutputStream
- Specified by:
getOutputStream
in interfaceorg.apache.commons.fileupload2.core.FileItem<MagicMimeTypeFileItem>
- Throws:
IOException
-
getName
- Specified by:
getName
in interfaceorg.apache.commons.fileupload2.core.FileItem<MagicMimeTypeFileItem>
-
isInMemory
public boolean isInMemory()- Specified by:
isInMemory
in interfaceorg.apache.commons.fileupload2.core.FileItem<MagicMimeTypeFileItem>
-
getSize
public long getSize()- Specified by:
getSize
in interfaceorg.apache.commons.fileupload2.core.FileItem<MagicMimeTypeFileItem>
-
get
public byte[] get()- Specified by:
get
in interfaceorg.apache.commons.fileupload2.core.FileItem<MagicMimeTypeFileItem>
-
getString
- Throws:
IOException
-
getString
- Specified by:
getString
in interfaceorg.apache.commons.fileupload2.core.FileItem<MagicMimeTypeFileItem>
-
getString
- Specified by:
getString
in interfaceorg.apache.commons.fileupload2.core.FileItem<MagicMimeTypeFileItem>
- Throws:
IOException
-
write
- Specified by:
write
in interfaceorg.apache.commons.fileupload2.core.FileItem<MagicMimeTypeFileItem>
- Throws:
IOException
-
delete
- Specified by:
delete
in interfaceorg.apache.commons.fileupload2.core.FileItem<MagicMimeTypeFileItem>
- Throws:
IOException
-
getFieldName
- Specified by:
getFieldName
in interfaceorg.apache.commons.fileupload2.core.FileItem<MagicMimeTypeFileItem>
-
setFieldName
- Specified by:
setFieldName
in interfaceorg.apache.commons.fileupload2.core.FileItem<MagicMimeTypeFileItem>
-
isFormField
public boolean isFormField()- Specified by:
isFormField
in interfaceorg.apache.commons.fileupload2.core.FileItem<MagicMimeTypeFileItem>
-
setFormField
- Specified by:
setFormField
in interfaceorg.apache.commons.fileupload2.core.FileItem<MagicMimeTypeFileItem>
-
getHeaders
public org.apache.commons.fileupload2.core.FileItemHeaders getHeaders()- Specified by:
getHeaders
in interfaceorg.apache.commons.fileupload2.core.FileItemHeadersProvider<MagicMimeTypeFileItem>
-
setHeaders
public MagicMimeTypeFileItem setHeaders(org.apache.commons.fileupload2.core.FileItemHeaders headers) - Specified by:
setHeaders
in interfaceorg.apache.commons.fileupload2.core.FileItemHeadersProvider<MagicMimeTypeFileItem>
-