@Immutable public abstract class AbstractBinary extends Object implements BinaryValue
BinaryValue that provides some common capabilities for other implementations.| Modifier and Type | Field and Description |
|---|---|
protected static byte[] |
EMPTY_CONTENT |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractBinary(BinaryKey key) |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(BinaryValue o) |
void |
dispose() |
boolean |
equals(Object obj) |
byte[] |
getHash()
Get the SHA-1 hash of the contents.
|
String |
getHexHash()
Get the hexadecimal form of the SHA-1 hash of the contents.
|
BinaryKey |
getKey()
Get the key for the binary value.
|
String |
getReadableSize() |
int |
hashCode() |
static BinaryKey |
keyFor(byte[] sha1) |
int |
read(byte[] b,
long position) |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetSizegetMimeType, getMimeTypeprotected AbstractBinary(BinaryKey key)
public static BinaryKey keyFor(byte[] sha1)
public int read(byte[] b,
long position)
throws IOException,
RepositoryException
read in interface BinaryIOExceptionRepositoryExceptionpublic BinaryKey getKey()
BinaryValuegetKey in interface BinaryValuepublic byte[] getHash()
BinaryRepeatedly calling this method should generally be efficient, as it most implementations will compute the hash only once.
MessageDigest.digest(byte[]),
MessageDigest.getInstance(String),
Binary.getHexHash()public String getHexHash()
BinaryRepeatedly calling this method should generally be efficient, as it most implementations will compute the hash only once.
Binary.getHash(), or a null string if the hash could not be computed or is not knownMessageDigest.digest(byte[]),
MessageDigest.getInstance(String),
Binary.getHash()public int compareTo(BinaryValue o)
compareTo in interface Comparable<BinaryValue>public String getReadableSize()
Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.