|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ccg.io.Compare
public class Compare
Some static methods to aid in the comparison of files.
This class provides some helper methods related to comparison of files (or streams of information).
| Constructor Summary | |
|---|---|
Compare()
|
|
| Method Summary | |
|---|---|
static long |
fileToFile(File from,
File to)
Compares the contents of one File to another File. |
static long |
fileToStream(File from,
InputStream to)
Compares the contents of a File to a InputStream. |
static long |
streamToFile(InputStream from,
File to)
Compares the contents of a InputStream to a
File. |
static long |
streamToStream(InputStream from,
InputStream to)
Compares contents of a InputStream to
anoterh InputStream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Compare()
| Method Detail |
|---|
public static long streamToStream(InputStream from,
InputStream to)
throws IOException
InputStream to
anoterh InputStream.
This method uses buffered stream wrappers around the streams passed to compare data from one stream to the other. After it finishes the compare (even it an exception occurs) an attempt will be made to close BOTH streams.
from - The InputStream to compare data from (must
not be null).to - The InputStream to compare data to (must
not be null).
IOException - If there is a problem compareing the data or closing one of the
files (both files will be closed prior to throwing the
exception).streamToFile(java.io.InputStream, java.io.File),
fileToStream(java.io.File, java.io.InputStream),
fileToFile(java.io.File, java.io.File)
public static long streamToFile(InputStream from,
File to)
throws IOException
InputStream to a
File.
This method converts the File object passed into a
InputStream and then invokes streamToStream(java.io.InputStream, java.io.InputStream) to compare the data from the stream to the file.
from - The InputStream to compare data from (must
not be null).to - The File to compare data to (must not be null).
IOException - If there is a problem compareing the data or closing one of the
files (both files will be closed prior to throwing the
exception).streamToStream(java.io.InputStream, java.io.InputStream)
public static long fileToStream(File from,
InputStream to)
throws IOException
File to a InputStream.
This method converts the File object passed into a
InputStream and then invokes streamToStream(java.io.InputStream, java.io.InputStream) to compare the data from the file to the stream.
from - The File to compare the data from (must not be null).to - The InputStream to compare data fo (must
not be null).
IOException - If there is a problem compareing the data or closing one of the
files (both files will be closed prior to throwing the
exception).streamToStream(java.io.InputStream, java.io.InputStream)
public static long fileToFile(File from,
File to)
throws IOException
File to another File.
This method determines the position within two files. Before comparing the contents of the two files, this method checks to see if the two File objects are equal (refer to the same file). If the two file objects are the same, then no comparision is done (returns -1 immediately).
from - The File to compare the data from (must not be null).to - The File to compare data to (must not be null).
IOException - If there is a problem compareing the data or closing one of the
files (both files will be closed prior to throwing the
exception).streamToStream(java.io.InputStream, java.io.InputStream)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||