|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tranche.hash.BigHash
public final class BigHash
A utility class for making and representing all of the hash information required for files on Tranche.
| Field Summary | |
|---|---|
static int |
HASH_LENGTH
The exact size of the hash. |
static int |
HASH_STRING_LENGTH_BASE16
BigHash length in Base16. |
static int |
HASH_STRING_LENGTH_BASE64
BigHash length in Base64. |
static int |
LENGTH_LENGTH
Length of bytes represented by BigHash. |
static int |
LENGTH_OFFSET
Offset of the beggingin of the Length portion of the BigHash. |
static int |
MD5_LENGTH
MD5 hash length in bytes. |
static int |
MD5_OFFSET
Offset of the beginning of the MD5 portion of the BigHash. |
static int |
SHA1_LENGTH
SHA-1 hash length in bytes. |
static int |
SHA1_OFFSET
Offset of the beginning of the SHA-1 portion of the BigHash. |
static int |
SHA256_LENGTH
SHA-256 hash length in bytes. |
static int |
SHA256_OFFSET
Offset of the beginning of the SHA-256 portion of the BigHash. |
| Constructor Summary | |
|---|---|
BigHash(byte[] bytes)
Construct a BigHash object from an array of bytes. |
|
BigHash(byte[] bytes,
byte[] padding)
Construct a BigHash object from an array of bytes and padding. |
|
BigHash(byte[] bytes,
int length)
Construct a BigHash object from an array of bytes using a length that starts from the begnning of the array. |
|
BigHash(byte[] bytes,
int length,
byte[] padding)
Construct a BigHash object from an array of bytes using a length and and additional padding. |
|
BigHash(java.io.File f)
Construct a BigHash object from a file. |
|
BigHash(java.io.File f,
byte[] padding)
Construct a BigHash object from a file with some additional padding. |
|
BigHash(java.io.InputStream is,
long length)
Construct a BigHash object from a stream of a specified length. |
|
BigHash(java.io.InputStream is,
long length,
byte[] padding)
Construct a BigHash object from a stream of specified length with some additional padding. |
|
| Method Summary | |
|---|---|
void |
add(BigHash hash)
|
BigHash |
clone()
|
int |
compareTo(BigHash bh)
Similar to standard compareTo() methods, this compares to determine the equality of two BigHash objects. |
static BigHash |
createFromBytes(byte[] bytes)
Create a BigHash object from a set of bytes. |
static BigHash |
createFromBytes(byte[] bytes,
int offset)
Create a BigHash object from a set of bytes with a given offset where to begin calculation of the hash. |
static BigHash |
createHashFromString(java.lang.String hash)
Create the hash from either a Base16 or Base64 encoded string. |
boolean |
equals(java.lang.Object obj)
A customization of the equals() method to check BigHash objects. |
long |
getLength()
Another method for getting BigHash length used for hashes prior to 5/1/2008. |
java.nio.ByteBuffer |
getMD5()
Return MD5 portion of BigHash. |
BigHash |
getNext()
Gets the next BigHash in the BigHash universe (this+1). |
BigHash |
getPrevious()
Gets the previous BigHash in the BigHash universe (this - 1). |
java.nio.ByteBuffer |
getSHA1()
Return SHA-1 portion of BigHash. |
java.nio.ByteBuffer |
getSHA256()
Return SHA-256 portion of BigHash. |
int |
hashCode()
A customization of the hashCode() method to check BigHash objects. |
java.lang.String |
toBase16String()
Return a Base16 encoded representation of the BigHash as a string. |
java.lang.String |
toBase64String()
Return a Base64 encoded representation of the BigHash as a string. |
byte[] |
toByteArray()
Return a byte array representation of the BigHash. |
java.lang.String |
toString()
Return a Base64 encoded representation of the BigHash as a string. |
java.lang.String |
toWebSafeString()
|
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int MD5_LENGTH
public static final int SHA1_LENGTH
public static final int SHA256_LENGTH
public static final int LENGTH_LENGTH
public static final int MD5_OFFSET
public static final int SHA1_OFFSET
public static final int SHA256_OFFSET
public static final int LENGTH_OFFSET
public static final int HASH_LENGTH
The exact size of the hash. Made up of:
Hence this constant's value is 76 bytes, the sum of its components.
public static final int HASH_STRING_LENGTH_BASE16
public static final int HASH_STRING_LENGTH_BASE64
| Constructor Detail |
|---|
public BigHash(byte[] bytes)
bytes -
public BigHash(byte[] bytes,
int length)
bytes - length -
public BigHash(byte[] bytes,
byte[] padding)
Construct a BigHash object from an array of bytes and padding.
bytes - padding -
public BigHash(byte[] bytes,
int length,
byte[] padding)
bytes - length - padding -
public BigHash(java.io.File f)
throws java.io.FileNotFoundException
f -
java.io.FileNotFoundException
public BigHash(java.io.File f,
byte[] padding)
throws java.io.FileNotFoundException
f - padding -
java.io.FileNotFoundException
public BigHash(java.io.InputStream is,
long length)
is - length -
public BigHash(java.io.InputStream is,
long length,
byte[] padding)
is - length - padding - | Method Detail |
|---|
public final java.nio.ByteBuffer getMD5()
public final java.nio.ByteBuffer getSHA1()
public final java.nio.ByteBuffer getSHA256()
public final long getLength()
public final byte[] toByteArray()
public final BigHash getNext()
Gets the next BigHash in the BigHash universe (this+1).
public final BigHash getPrevious()
Gets the previous BigHash in the BigHash universe (this - 1).
public final void add(BigHash hash)
hash - public BigHash clone()
clone in class java.lang.Objectpublic int compareTo(BigHash bh)
compareTo in interface java.lang.Comparable<BigHash>bh -
public static final BigHash createFromBytes(byte[] bytes)
bytes -
public static final BigHash createFromBytes(byte[] bytes,
int offset)
bytes - offset -
public final java.lang.String toString()
toString in class java.lang.Objectpublic final java.lang.String toBase64String()
public final java.lang.String toBase16String()
public final java.lang.String toWebSafeString()
public final boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object
public static final BigHash createHashFromString(java.lang.String hash)
throws java.lang.RuntimeException
java.lang.RuntimeException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||