Class ComparatorInputStream
java.lang.Object
java.io.InputStream
java.io.ByteArrayInputStream
org.eclipse.tycho.artifactcomparator.ComparatorInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
Input stream to carry some important information for comparison and allows direct access to the
underlying buffer.
- Author:
- christoph
-
Field Summary
Fields inherited from class java.io.ByteArrayInputStream
buf, count, mark, pos -
Constructor Summary
ConstructorsConstructorDescriptionComparatorInputStream(byte[] content) ComparatorInputStream(InputStream stream) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]asBytes()compare(ComparatorInputStream other) Compares this stream directly to another stream on a by-by-byte basis, this is independent of the state of the streams, e.g number of bytes read, closing or mark state.intsize()Methods inherited from class java.io.ByteArrayInputStream
available, close, mark, markSupported, read, read, readAllBytes, readNBytes, reset, skip, transferToMethods inherited from class java.io.InputStream
nullInputStream, read, readNBytes, skipNBytes
-
Constructor Details
-
ComparatorInputStream
- Throws:
IOException
-
ComparatorInputStream
public ComparatorInputStream(byte[] content)
-
-
Method Details
-
size
public int size()- Returns:
- the total number of bytes of this stream
-
asNewStream
- Returns:
- a new stream backed by this stream data that could be read independently
-
asString
- Parameters:
charset-- Returns:
- the content of this stream as a string with the given charset
-
asBytes
public byte[] asBytes() -
compare
Compares this stream directly to another stream on a by-by-byte basis, this is independent of the state of the streams, e.g number of bytes read, closing or mark state.- Parameters:
other-- Returns:
ArtifactDelta.DEFAULTif there is any difference ornullotherwise.
-