Package org.jets3t.service.model
Class GSObject
java.lang.Object
org.jets3t.service.model.BaseStorageItem
org.jets3t.service.model.StorageObject
org.jets3t.service.model.GSObject
- All Implemented Interfaces:
Cloneable
A Google Storage object.
- Author:
- James Murty
-
Field Summary
Fields inherited from class org.jets3t.service.model.StorageObject
METADATA_HEADER_HASH_MD5, METADATA_HEADER_ORIGINAL_HASH_MD5
Fields inherited from class org.jets3t.service.model.BaseStorageItem
METADATA_HEADER_CONTENT_DISPOSITION, METADATA_HEADER_CONTENT_ENCODING, METADATA_HEADER_CONTENT_LANGUAGE, METADATA_HEADER_CONTENT_LENGTH, METADATA_HEADER_CONTENT_MD5, METADATA_HEADER_CONTENT_TYPE, METADATA_HEADER_CREATION_DATE, METADATA_HEADER_DATE, METADATA_HEADER_ETAG, METADATA_HEADER_LAST_MODIFIED_DATE
-
Constructor Summary
ConstructorsConstructorDescriptionGSObject()
Create an object without any associated information whatsoever.Create an object representing a file.Create an object without any associated data, and no associated bucket.Create an object representing text data. -
Method Summary
Methods inherited from class org.jets3t.service.model.StorageObject
addAllMetadata, addMetadata, closeDataInputStream, getBucketName, getContentDisposition, getContentEncoding, getContentLanguage, getContentLength, getContentType, getDataInputFile, getDataInputStream, getETag, getKey, getLastModifiedDate, getMd5HashAsBase64, getMd5HashAsHex, getModifiableMetadata, getStorageClass, isDirectoryPlaceholder, isMetadataComplete, setAcl, setBucketName, setContentDisposition, setContentEncoding, setContentLanguage, setContentLength, setContentType, setDataInputFile, setDataInputStream, setETag, setKey, setLastModifiedDate, setMd5Hash, setMetadataComplete, setStorageClass, verifyData, verifyData, verifyData
Methods inherited from class org.jets3t.service.model.BaseStorageItem
addMetadata, addMetadata, containsMetadata, getMetadata, getMetadataMap, getName, getOwner, removeMetadata, replaceAllMetadata, setName, setOwner
-
Constructor Details
-
GSObject
Create an object representing a file. The object is initialised with the file's name as its key, the file's content as its data, a content type based on the file's extension (seeMimetypes
), and a content length matching the file's size. The file's MD5 hash value is also calculated and provided to the service so it can verify that no data are corrupted in transit.NOTE: The automatic calculation of a file's MD5 hash digest as performed by this constructor could take some time for large files, or for many small ones.
- Parameters:
file
- the file the object will represent. This file must exist and be readable.- Throws:
IOException
- when an i/o error occurred reading the fileNoSuchAlgorithmException
- when this JRE doesn't support the MD5 hash algorithm
-
GSObject
Create an object representing text data. The object is initialized with the given key, the given string as its data content (encoded as UTF-8), a content type oftext/plain; charset=utf-8
, and a content length matching the string's length. The given string's MD5 hash value is also calculated and provided to the service so it can verify that no data are corrupted in transit.NOTE: The automatic calculation of the MD5 hash digest as performed by this constructor could take some time for large strings, or for many small ones.
- Parameters:
key
- the key name for the object.dataString
- the text data the object will contain. Text data will be encoded as UTF-8. This string cannot be null.- Throws:
IOException
NoSuchAlgorithmException
- when this JRE doesn't support the MD5 hash algorithm
-
GSObject
Create an object without any associated data, and no associated bucket.- Parameters:
key
- the key name for the object.
-
GSObject
public GSObject()Create an object without any associated information whatsoever.
-
-
Method Details
-
toString
- Overrides:
toString
in classStorageObject
-
getAcl
- Overrides:
getAcl
in classStorageObject
- Returns:
- the object's ACL, or null if it is unknown.
-
setAcl
Set the object's ACL.- Parameters:
acl
-
-
clone
- Overrides:
clone
in classStorageObject
-
cast
-