|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jboss.dna.graph.properties.basic.InMemoryBinary
@Immutable public class InMemoryBinary

An implementation of Binary that keeps the binary data in-memory.
| Field Summary | |
|---|---|
protected static Set<String> |
ALGORITHMS_NOT_FOUND_AND_LOGGED
|
protected static byte[] |
EMPTY_CONTENT
|
| Constructor Summary | |
|---|---|
InMemoryBinary(byte[] bytes)
|
|
| Method Summary | |
|---|---|
void |
acquire()
Acquire any resources for this data. |
int |
compareTo(Binary o)
|
boolean |
equals(Object obj)
|
byte[] |
getBytes()
Get the contents of this data as a byte array. |
byte[] |
getHash()
Get the SHA-1 hash of the contents. |
protected byte[] |
getHash(String digestName)
Get the hash of the contents, using the digest identified by the supplied name. |
long |
getSize()
Get the length of this binary data. |
InputStream |
getStream()
Get the contents of this data as a stream. |
void |
release()
Release any acquired resources. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final Set<String> ALGORITHMS_NOT_FOUND_AND_LOGGED
protected static final byte[] EMPTY_CONTENT
| Constructor Detail |
|---|
public InMemoryBinary(byte[] bytes)
| Method Detail |
|---|
public long getSize()
getSize in interface BinaryBinary.acquire()public byte[] getHash()
Repeatedly calling this method should generally be efficient, as it most implementations will compute the hash only once.
getHash in interface BinaryBinary.getHash()
protected byte[] getHash(String digestName)
throws NoSuchAlgorithmException
digestName - the name of the hashing function (or message digest) that should be used
NoSuchAlgorithmException - if the supplied algorithm could not be foundpublic byte[] getBytes()
getBytes in interface BinaryBinary.acquire()public InputStream getStream()
getStream in interface BinaryBinary.acquire()public void acquire()
acquire in interface BinaryBinary.release()public void release()
release in interface BinaryBinary.acquire()public int compareTo(Binary o)
compareTo in interface Comparable<Binary>public boolean equals(Object obj)
equals in class Objectpublic String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||