public class MemoryDataElement extends AbstractDataElement implements DataElement
Constructor and Description |
---|
MemoryDataElement(MemoryDigitalObject dobj,
java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
void |
delete()
Deletes the data element from its digital object.
|
void |
deleteAttribute(java.lang.String aname)
Deletes a particular attribute.
|
void |
deleteAttributes(java.util.List<java.lang.String> names)
Deletes multiple attributes.
|
java.lang.String |
getAttribute(java.lang.String aname)
Returns the value for a particular attribute
|
java.util.Map<java.lang.String,java.lang.String> |
getAttributes()
Returns a Map view of the attributes of the data element.
|
DigitalObject |
getDigitalObject()
Returns the digital object of this data element.
|
java.lang.String |
getName()
Returns the name of this data element.
|
long |
getSize()
Returns the number of bytes of data in this data element.
|
java.lang.String |
getType()
Returns the MIME type of the given data.
|
CloseableIterator<java.util.Map.Entry<java.lang.String,java.lang.String>> |
listAttributes()
Returns a CloseableIterator view of the attributes of the data element.
|
java.io.InputStream |
read()
Provides access to the data as an InputStream.
|
void |
setAttribute(java.lang.String name,
java.lang.String value)
Sets a particular attribute.
|
void |
setAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)
Sets the value of multiple attributes.
|
void |
setType(java.lang.String type)
Sets the MIME type of the given data.
|
long |
write(java.io.InputStream in,
boolean append)
Writes new data into the data element.
|
read, write
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
read, write
public MemoryDataElement(MemoryDigitalObject dobj, java.lang.String name)
public DigitalObject getDigitalObject()
DataElement
getDigitalObject
in interface DataElement
public java.lang.String getName()
DataElement
getName
in interface DataElement
public void delete()
DataElement
delete
in interface DataElement
delete
in class AbstractDataElement
public java.util.Map<java.lang.String,java.lang.String> getAttributes()
DataElement
getAttributes
in interface DataElement
getAttributes
in class AbstractDataElement
public CloseableIterator<java.util.Map.Entry<java.lang.String,java.lang.String>> listAttributes()
DataElement
listAttributes
in interface DataElement
listAttributes
in class AbstractDataElement
public java.lang.String getAttribute(java.lang.String aname)
DataElement
getAttribute
in interface DataElement
getAttribute
in class AbstractDataElement
aname
- the attribute namepublic void setAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)
DataElement
setAttributes
in interface DataElement
setAttributes
in class AbstractDataElement
attributes
- the attributes to set, mapped to their new valuespublic void setAttribute(java.lang.String name, java.lang.String value)
DataElement
setAttribute
in interface DataElement
name
- the attribute namevalue
- the attribute value; if null, the attribute will be deleted.public void deleteAttributes(java.util.List<java.lang.String> names)
DataElement
deleteAttributes
in interface DataElement
deleteAttributes
in class AbstractDataElement
names
- the names of the attributes to deletepublic void deleteAttribute(java.lang.String aname)
DataElement
deleteAttribute
in interface DataElement
aname
- the name of the attribute to deletepublic java.lang.String getType()
DataElement
getType
in interface DataElement
getType
in class AbstractDataElement
public void setType(java.lang.String type)
DataElement
setType
in interface DataElement
setType
in class AbstractDataElement
type
- the new MIME typepublic java.io.InputStream read()
DataElement
read
in interface DataElement
public long write(java.io.InputStream in, boolean append) throws java.io.IOException
DataElement
write
in interface DataElement
in
- an InputStream streaming the new dataappend
- whether to append the new data to the existing datajava.io.IOException
public long getSize()
DataElement
getSize
in interface DataElement