|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectariba.util.core.ComponentChecksum
ariba.util.core.FileComponentChecksum
public class FileComponentChecksum
This class extends the ComponentChecksum class to compute a checksum for files and directories. The checksum used is Adler32. Adler32 is generally considedered as good as CRC32, and is twice as fast. In addition to the implmentation of getChecksum, several methods for adding files and directories to the checksum are included. The FileComponentChecksum object is not synchronized, and uses a object that is not thread safe, viz. the Checksum.
Constructor Summary | |
---|---|
FileComponentChecksum(java.lang.String name)
|
Method Summary | |
---|---|
void |
addDirectory(java.io.File dir)
Add all the files in the specified directory. |
void |
addDirectory(java.lang.String name)
Add directory specified by string name |
void |
addDirectoryDeep(java.io.File dir)
Add all the files in the specified directory. |
void |
addDirectoryDeep(java.lang.String name)
Add directory specified by string name, and recurse to all subdirectories. |
void |
addFile(java.io.File f)
Add the specified File to the checksum. |
void |
addFile(java.lang.String name)
Add the file specified by the string name |
void |
addFileList(java.util.List v)
Adds all of the files in the given List. |
void |
addFileList(java.util.List v,
boolean sortFirst)
Adds all of the files in the given List. |
byte[] |
getChecksum()
Return the accumulated checksum as a byte array (big endian). |
Methods inherited from class ariba.util.core.ComponentChecksum |
---|
compareChecksum, getName, makeListOfBytes, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FileComponentChecksum(java.lang.String name)
Method Detail |
---|
public byte[] getChecksum()
getChecksum
in class ComponentChecksum
public void addFile(java.io.File f) throws ComponentChecksumException
f
- File whose name and contents we want to add to the checksum
ComponentChecksumException
- The file was not a
normal file, the file did not exist, or there was some other
IO error.public void addFile(java.lang.String name) throws ComponentChecksumException
name
- String name of the file to add
ComponentChecksumException
public void addFileList(java.util.List v) throws ComponentChecksumException
v
- List containing the filenames
ComponentChecksumException
- The file was not a
normal file, the file did not exist, or there was some other
IO error.public void addFileList(java.util.List v, boolean sortFirst) throws ComponentChecksumException
v
- List containing the filenamessortFirst
- if true, sorts the filenames before adding them to
this checksum (the checksum value is dependent on the order in
which files are added)
ComponentChecksumException
- The file was not a
normal file, the file did not exist, or there was some other
IO error.public void addDirectory(java.io.File dir) throws ComponentChecksumException
dir
- File for the directory
ComponentChecksumException
- The File specified is not
a directory or did not exist, or some other IO exception occurred.public void addDirectory(java.lang.String name) throws ComponentChecksumException
name
- name of the directory to add
ComponentChecksumException
- the directory does not
exit, is not a directory, or there was a file IO error while
processingpublic void addDirectoryDeep(java.io.File dir) throws ComponentChecksumException
dir
- File for the directory
ComponentChecksumException
- The File specified is not
a directory or did not exist, or some other IO exception occurred.public void addDirectoryDeep(java.lang.String name) throws ComponentChecksumException
name
- name of the directory to add
ComponentChecksumException
- the directory does not
exit, is not a directory, or there was a file IO error while
processing
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |