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 Form| Modifier 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
|
org.apache.commons.fileupload.FileItemHeaders |
getHeaders() |
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
|
void |
setHeaders(org.apache.commons.fileupload.FileItemHeaders fih) |
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.FileItempublic byte[] get()
get in interface org.apache.commons.fileupload.FileItempublic String getContentType()
getContentType in interface org.apache.commons.fileupload.FileItempublic String getFieldName()
getFieldName in interface org.apache.commons.fileupload.FileItempublic InputStream getInputStream() throws IOException
getInputStream in interface org.apache.commons.fileupload.FileItemIOException - ioexceptionpublic String getName()
getName in interface org.apache.commons.fileupload.FileItempublic OutputStream getOutputStream() throws IOException
getOutputStream in interface org.apache.commons.fileupload.FileItemIOException - ioepublic long getSize()
getSize in interface org.apache.commons.fileupload.FileItempublic String getString()
getString in interface org.apache.commons.fileupload.FileItempublic String getString(String encoding) throws UnsupportedEncodingException
getString in interface org.apache.commons.fileupload.FileItemUnsupportedEncodingExceptionpublic boolean isFormField()
isFormField in interface org.apache.commons.fileupload.FileItempublic boolean isInMemory()
isInMemory in interface org.apache.commons.fileupload.FileItempublic void setFieldName(String name)
setFieldName in interface org.apache.commons.fileupload.FileItemname - -public void setFormField(boolean state)
setFormField in interface org.apache.commons.fileupload.FileItemstate - -public void write(File file) throws Exception
write in interface org.apache.commons.fileupload.FileItemfile - -Exception - expublic static final String buildFileMetadata(String strFileName, long lSize, String strFileBlobId, String strContentType)
strFileName - filenamelSize - sizestrFileBlobId - the blob idstrContentType - the content typepublic org.apache.commons.fileupload.FileItemHeaders getHeaders()
getHeaders in interface org.apache.commons.fileupload.FileItemHeadersSupportpublic void setHeaders(org.apache.commons.fileupload.FileItemHeaders fih)
setHeaders in interface org.apache.commons.fileupload.FileItemHeadersSupportCopyright © 2021 City of Paris. All rights reserved.