public class BlobStoreFileItem extends Object implements org.apache.commons.fileupload.FileItem
FileItem
. #buildFileMetadata(String, long, String)
to build the
FileMetadata.#buildFileMetadata(String, long, String)
,
BlobStoreFileItem(String, IBlobStoreService)
,
Serialized FormModifier and Type | Field and Description |
---|---|
static String |
JSON_KEY_FILE_BLOB_ID |
static String |
JSON_KEY_FILE_CONTENT_TYPE |
static String |
JSON_KEY_FILE_METADATA_BLOB_ID |
static String |
JSON_KEY_FILE_NAME |
static String |
JSON_KEY_FILE_SIZE |
Constructor and Description |
---|
BlobStoreFileItem(String strBlobId,
IBlobStoreService blobstoreService)
Builds a fileItem from blobstore. get() method is lazy.
|
Modifier and Type | Method and Description |
---|---|
static String |
buildFileMetadata(String strFileName,
long lSize,
String strFileBlobId,
String strContentType)
Builds the json value of a file metadata.
|
void |
delete()
Deletes both blobs : metadata AND content.
|
byte[] |
get() |
String |
getBlobId()
Gets the metadata blob id
|
String |
getContentType() |
String |
getFieldName()
Not supported
|
String |
getFileBlobId()
Gets the file blob id
|
InputStream |
getInputStream() |
String |
getName() |
OutputStream |
getOutputStream()
Not supported - throws UnsupportedOperationException exception
|
long |
getSize() |
String |
getString() |
String |
getString(String encoding) |
boolean |
isFormField()
Not supported
|
boolean |
isInMemory()
Always false.
|
void |
setFieldName(String name)
Not supported
|
void |
setFormField(boolean state)
Not supported
|
String |
toString() |
void |
write(File file)
Not supported
|
public static final String JSON_KEY_FILE_SIZE
public static final String JSON_KEY_FILE_NAME
public static final String JSON_KEY_FILE_CONTENT_TYPE
public static final String JSON_KEY_FILE_BLOB_ID
public static final String JSON_KEY_FILE_METADATA_BLOB_ID
public BlobStoreFileItem(String strBlobId, IBlobStoreService blobstoreService) throws NoSuchBlobException
IBlobStoreService
is here to prevent specific usage for the
fileItem so it can be used as any other FileItem.strBlobId
- the blob idblobstoreService
- the blob serviceNoSuchBlobException
- if blob cannot be parsedpublic String getBlobId()
public String getFileBlobId()
public void delete()
delete
in interface org.apache.commons.fileupload.FileItem
public byte[] get()
get
in interface org.apache.commons.fileupload.FileItem
public String getContentType()
getContentType
in interface org.apache.commons.fileupload.FileItem
public String getFieldName()
getFieldName
in interface org.apache.commons.fileupload.FileItem
public InputStream getInputStream() throws IOException
getInputStream
in interface org.apache.commons.fileupload.FileItem
IOException
- ioexceptionpublic String getName()
getName
in interface org.apache.commons.fileupload.FileItem
public OutputStream getOutputStream() throws IOException
getOutputStream
in interface org.apache.commons.fileupload.FileItem
IOException
- ioepublic long getSize()
getSize
in interface org.apache.commons.fileupload.FileItem
public String getString()
getString
in interface org.apache.commons.fileupload.FileItem
public String getString(String encoding) throws UnsupportedEncodingException
getString
in interface org.apache.commons.fileupload.FileItem
UnsupportedEncodingException
public boolean isFormField()
isFormField
in interface org.apache.commons.fileupload.FileItem
public boolean isInMemory()
isInMemory
in interface org.apache.commons.fileupload.FileItem
public void setFieldName(String name)
setFieldName
in interface org.apache.commons.fileupload.FileItem
name
- -public void setFormField(boolean state)
setFormField
in interface org.apache.commons.fileupload.FileItem
state
- -public void write(File file) throws Exception
write
in interface org.apache.commons.fileupload.FileItem
file
- -Exception
- expublic static final String buildFileMetadata(String strFileName, long lSize, String strFileBlobId, String strContentType)
strFileName
- filenamelSize
- sizestrFileBlobId
- the blob idstrContentType
- the content typeCopyright © 2016 Mairie de Paris. All Rights Reserved.