org.nhindirect.xd.common
Class DirectDocument2

java.lang.Object
  extended by org.nhindirect.xd.common.DirectDocument2

public class DirectDocument2
extends Object

Abstract representation of a document with supporting metadata. TODO: This replace DirectDocument with this class.. wanted to wait to avoid any merge conflicts for ongoing XD* work.

Author:
beau

Nested Class Summary
static class DirectDocument2.Metadata
          Abstract representation of document metadata.
 
Constructor Summary
DirectDocument2()
          Default document constructor.
DirectDocument2(File file)
           
 
Method Summary
 byte[] getData()
          Get the value of data.
 DirectDocument2.Metadata getMetadata()
          Get the value of metadata.
static String getSha1Hash(byte[] bytes)
          Calculate the SHA-1 hash for the provided array of bytes.
static String getSha1Hash(String string)
          Calculate the SHA-1 hash for the provided string.
 void setData(byte[] data)
          Set the value of data.
 void setMetadata(DirectDocument2.Metadata metadata)
          Set the value of metadata.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectDocument2

public DirectDocument2()
Default document constructor.


DirectDocument2

public DirectDocument2(File file)
                throws IOException
Parameters:
file -
Throws:
IOException
Method Detail

getMetadata

public DirectDocument2.Metadata getMetadata()
Get the value of metadata.

Returns:
the metadata.

setMetadata

public void setMetadata(DirectDocument2.Metadata metadata)
Set the value of metadata.

Parameters:
metadata - The metadata to set.

getData

public byte[] getData()
Get the value of data.

Returns:
the data The value of data.

setData

public void setData(byte[] data)
Set the value of data.

Parameters:
data - The data to set;

getSha1Hash

public static String getSha1Hash(byte[] bytes)
Calculate the SHA-1 hash for the provided array of bytes.

Parameters:
bytes - Bytes from which to calculate the SHA-1 hash.
Returns:
the SHA-1 hash or null if unable to calculate.

getSha1Hash

public static String getSha1Hash(String string)
Calculate the SHA-1 hash for the provided string.

Parameters:
string - The string from which to calculate the SHA-1 hash.
Returns:
the SHA-1 hash or null if unable to calculate.


Copyright © 2010-2011. All Rights Reserved.