public interface ObjectAttributeView extends AttributeView
Modifier and Type | Method and Description |
---|---|
java.util.Iterator<Attribute> |
iterator()
Returns an iterator to the user-defined attributes defined for the object this view relates to.
|
java.util.Iterator<Attribute> |
iterator(int attributesPerNetworkCall)
Returns an iterator to the user-defined attributes defined for the object this view relates to.
|
java.util.Set<Attribute> |
set()
Returns the set of user-defined attributes defined for the object this view relates to.
|
java.util.Set<Attribute> |
set(int attributesPerNetworkCall)
Returns the set of user-defined attributes defined for the object this view relates to.
|
int |
write(java.lang.String name,
java.nio.ByteBuffer src,
boolean searchable)
Writes the value of a user-defined attribute from a buffer.
|
int |
write(java.lang.String name,
java.nio.ByteBuffer src,
boolean searchable,
boolean searchabeInCDB)
See description for
int write(String name, ByteBuffer src, boolean searchable) |
int write(java.lang.String name, java.nio.ByteBuffer src, boolean searchable) throws java.io.IOException
This method writes the value of the attribute from a given buffer as
a sequence of bytes. The size of the value to transfer is r
,
where r
is the number of bytes remaining in the buffer, that is
src.remaining()
. The sequence of bytes is transferred from the
buffer starting at index p
, where p
is the buffer's
position. Upon return, the buffer's position will be equal to p + n
, where n
is the number of bytes transferred; its limit
will not have changed.
If an attribute of the given name already exists then its value is replaced. If the attribute does not exist then it is created. If it implementation specific if a test to check for the existence of the attribute and the creation of attribute are atomic with repect to other file system activities.
Where there is insufficient space to store the attribute, or the
attribute name or value exceed an implementation specific maximum size
then an IOException
is thrown.
Usage Example: Suppose we want to write a file's MIME type as a user-defined attribute:
AttributeView() view = object.getAttributeView(); view.write("user.mimetype", Charset.defaultCharset().encode("text/html", false));
name
- The attribute namesrc
- The buffer containing the attribute valuesearchable
- Searchable flag associated to this attribute value.java.io.IOException
- If an I/O error occursint write(java.lang.String name, java.nio.ByteBuffer src, boolean searchable, boolean searchabeInCDB) throws java.io.IOException
int write(String name, ByteBuffer src, boolean searchable)
name
- The attribute namesrc
- The buffer containing the attribute valuesearchable
- Searchable flag associated to this attribute value.searchabeInCDB
- if true this attribute is searchable in cluster's contentDBjava.io.IOException
- If an I/O error occursjava.util.Set<Attribute> set(int attributesPerNetworkCall) throws java.io.IOException
This method allows specifying the number of attributes to be transmitted in each network call to the server.
The bigger the value, the most likely to overflow network packets. The smaller the value, the longer this method will take to return the results. The default is 100.
attributesPerNetworkCall
- attributes collected on each network calljava.io.IOException
java.util.Set<Attribute> set() throws java.io.IOException
java.io.IOException
java.util.Iterator<Attribute> iterator(int attributesPerNetworkCall) throws java.io.IOException
This method allows specifying the number of attributes to be transmitted in each network call to the server.
The bigger the value, the most likely to overflow network packets. The smaller the value, the longer this method will take to return the results. The default is 100.
attributesPerNetworkCall
- attributes collected on each network calljava.io.IOException
java.util.Iterator<Attribute> iterator() throws java.io.IOException
java.io.IOException