Package org.dspace.content
Class Bitstream
java.lang.Object
org.dspace.content.DSpaceObject
org.dspace.content.Bitstream
- All Implemented Interfaces:
Serializable,DSpaceObjectLegacySupport,ReloadableEntity<UUID>
Class representing bitstreams stored in the DSpace system.
When modifying the bitstream metadata, changes are not reflected in the
database until update is called. Note that you cannot alter
the contents of a bitstream; you need to create a new bitstream.
- Author:
- Robert Tansley
- See Also:
-
Field Summary
Fields inherited from class org.dspace.content.DSpaceObject
id, predefinedUUID -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedProtected constructor, create object using:BitstreamService.create(Context, Bundle, InputStream)orBitstreamService.create(Context, InputStream) -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturntrueifotheris the same Bitstream as this object,falseotherwiseprotected BitstreamFormatGet the bundles this bitstream appears inGet the checksum of the content of the bitstream, for integrity checkingGet the algorithm used to calculate the checksumGet the description of this bitstream - optional free text, typically provided by a user at submission timeGet the format of the bitstreamgetFormatDescription(Context context) Get the description of the format - either the user's or the description of the format defined by the system.getName()Get the name of this bitstream - typically the filename, without any path informationintGet the sequence ID of this bitstream.longGet the size of the bitstreamGet the source of this bitstream - typically the filename with path information (if originally provided) or the name of the tool that generated this bitstreamintGet the asset store number where this bitstream is storedintgetType()return type found in ConstantsGet the user's format description.inthashCode()booleanBitstreams are only logically deleted (via a flag in the database).voidsetAcceptanceDate(Context context, DCDate acceptanceDate) Add date for bitstream granted (used into the use case for license grant theLicenseUtils.grantLicense(Context, Item, String, String)voidsetChecksum(String checksum) voidsetChecksumAlgorithm(String checksumAlgorithm) voidsetCollection(Collection collection) voidsetCommunity(Community community) voidsetDeleted(boolean deleted) voidsetDescription(Context context, String n) Set the description of the bitstreamvoidsetFormat(Context context, BitstreamFormat f) Set the format of the bitstream.voidsetInternalId(String internalId) voidSet the name of the bitstreamvoidsetSequenceID(int sid) Set the sequence ID of this bitstream.voidsetSizeBytes(long sizeBytes) voidSet the source of the bitstreamvoidsetStoreNumber(int storeNumber) Set the asset store number where this bitstream is storedvoidsetUserFormatDescription(Context context, String desc) Set the user's format description.Methods inherited from class org.dspace.content.DSpaceObject
addDetails, addHandle, addMetadata, clearDetails, clearModified, getDetails, getHandle, getHandles, getID, getMetadata, getPredefinedUUID, getResourcePolicies, isMetadataModified, isModified, removeMetadata, removeMetadata, setMetadata, setMetadataModified, setModified
-
Constructor Details
-
Bitstream
protected Bitstream()Protected constructor, create object using:BitstreamService.create(Context, Bundle, InputStream)orBitstreamService.create(Context, InputStream)
-
-
Method Details
-
getSequenceID
public int getSequenceID()Get the sequence ID of this bitstream. The sequence ID is a unique (within an Item) integer that references this bitstream. It acts as a "persistent" identifier within the Item for this Bitstream (as Bitstream names are not persistent). Because it is unique within an Item, sequence IDs are assigned by the ItemService.update() method.- Returns:
- the sequence ID
- See Also:
-
setSequenceID
public void setSequenceID(int sid) Set the sequence ID of this bitstream. The sequence ID is a unique (within an Item) integer that references this bitstream. While this method is public, it should only be used by ItemService.update() or other methods which validate the uniqueness of the ID within the associated Item. This method itself does not validate uniqueness of the ID, nor does the underlying database table.- Parameters:
sid- the ID- See Also:
-
getName
Get the name of this bitstream - typically the filename, without any path information- Specified by:
getNamein classDSpaceObject- Returns:
- the name of the bitstream
-
setName
Set the name of the bitstream- Parameters:
context- contextn- the new name of the bitstream- Throws:
SQLException- if database error
-
getSource
Get the source of this bitstream - typically the filename with path information (if originally provided) or the name of the tool that generated this bitstream- Returns:
- the source of the bitstream
-
setSource
Set the source of the bitstream- Parameters:
context- contextn- the new source of the bitstream- Throws:
SQLException- if database error
-
getDescription
Get the description of this bitstream - optional free text, typically provided by a user at submission time- Returns:
- the description of the bitstream
-
setDescription
Set the description of the bitstream- Parameters:
context- contextn- the new description of the bitstream- Throws:
SQLException- if database error
-
getChecksum
Get the checksum of the content of the bitstream, for integrity checking- Returns:
- the checksum
-
setChecksum
-
getChecksumAlgorithm
Get the algorithm used to calculate the checksum- Returns:
- the algorithm, e.g. "MD5"
-
setChecksumAlgorithm
-
getSizeBytes
public long getSizeBytes()Get the size of the bitstream- Returns:
- the size in bytes
-
setSizeBytes
public void setSizeBytes(long sizeBytes) -
getUserFormatDescription
Get the user's format description. Returns null if the format is known by the system.- Returns:
- the user's format description.
-
getBitstreamFormat
-
getFormat
Get the format of the bitstream- Parameters:
context- context- Returns:
- the format of this bitstream
- Throws:
SQLException- if database error
-
isDeleted
Bitstreams are only logically deleted (via a flag in the database). This method allows us to verify is the bitstream is still valid- Returns:
- true if the bitstream has been deleted
- Throws:
SQLException- if database error
-
setDeleted
public void setDeleted(boolean deleted) -
getBundles
Get the bundles this bitstream appears in- Returns:
- array of
Bundles this bitstream appears in - Throws:
SQLException- if database error
-
getType
public int getType()return type found in Constants- Specified by:
getTypein classDSpaceObject- Returns:
- int Constants.BITSTREAM
-
getCollection
-
setCollection
-
getCommunity
-
setCommunity
-
getStoreNumber
public int getStoreNumber()Get the asset store number where this bitstream is stored- Returns:
- the asset store number of the bitstream
-
setStoreNumber
public void setStoreNumber(int storeNumber) Set the asset store number where this bitstream is stored- Parameters:
storeNumber- asset store number of the bitstream
-
getInternalId
-
setInternalId
-
setUserFormatDescription
Set the user's format description. This implies that the format of the bitstream is uncertain, and the format is set to "unknown."- Parameters:
context- The relevant DSpace Context.desc- the user's description of the format- Throws:
SQLException- if database error
-
getFormatDescription
Get the description of the format - either the user's or the description of the format defined by the system.- Parameters:
context- context- Returns:
- a description of the format.
- Throws:
SQLException- if database error
-
setFormat
Set the format of the bitstream. If the user has supplied a type description, it is cleared. Passing innullsets the type of this bitstream to "unknown".- Parameters:
context- contextf- the format of this bitstream, ornullfor unknown- Throws:
SQLException- if database error
-
getLegacyId
- Specified by:
getLegacyIdin interfaceDSpaceObjectLegacySupport- Returns:
- the old integer based legacy identifier
-
equals
Returntrueifotheris the same Bitstream as this object,falseotherwise -
hashCode
public int hashCode() -
setAcceptanceDate
Add date for bitstream granted (used into the use case for license grant theLicenseUtils.grantLicense(Context, Item, String, String)- Parameters:
context- the dspace contextacceptanceDate- the granted date- Throws:
SQLException
-