|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.tffenterprises.io.DataOutputChecksum
public class DataOutputChecksum
DataOutputChecksum
is a utility when using implementors
of the java.util.zip.Checksum
interface. This class
acts as a wrapper for a Checksum object, adding to it the methods
declared by the java.io.DataOutput
interface.
Field Summary | |
---|---|
private byte[] |
buf
private buffer to assist with the more complicated DataOutput methods. |
private java.util.zip.Checksum |
cs
The encapsulated checksum object. |
Constructor Summary | |
---|---|
private |
DataOutputChecksum()
A private constructor. |
|
DataOutputChecksum(java.util.zip.Checksum checksum)
Creates a DataOutputChecksum that encapsulate a Checksum
implementor. |
Method Summary | |
---|---|
java.util.zip.Checksum |
getChecksum()
Returns the encapsulated checksum object. |
long |
getValue()
Returns the current checksum value. |
void |
reset()
Resets the checksum to its initial value. |
void |
update(byte[] b)
Updates the checksum with the specified byte array. |
void |
update(byte[] b,
int off,
int len)
Updates the checksum with len bytes from the specified
byte array, starting from offset off |
void |
update(int b)
Updates the checksum with a single byte b |
void |
write(byte[] b)
Writes an array. |
void |
write(byte[] b,
int off,
int len)
Writes a subarray from an offset. |
void |
write(int b)
Writes a byte. |
void |
writeBoolean(boolean bool)
Writes a boolean value to this output stream. |
void |
writeByte(int b)
Writes a byte value to this output stream. |
void |
writeBytes(java.lang.String s)
Writes the low-order-byte values of the given String parameter's chars, effectively writing the characters as ISO-8859-1 encoding. |
void |
writeChar(int c)
Writes a char value to this output stream. |
void |
writeChars(java.lang.String s)
Writes a String as a sequence of chars (2-byte values). |
void |
writeDouble(double d)
Writes a double value to this output stream. |
void |
writeFloat(float f)
Writes a float value to this output stream. |
void |
writeInt(int i)
Writes an int value to this output stream. |
void |
writeLong(long l)
Writes a long value to this output stream. |
void |
writeShort(int s)
Writes a short value to this output stream. |
void |
writeUTF(java.lang.String s)
Writes a String encoded as UTF-8. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private byte[] buf
private java.util.zip.Checksum cs
Constructor Detail |
---|
private DataOutputChecksum()
Checksum
, the default constructor can't be used.
public DataOutputChecksum(java.util.zip.Checksum checksum)
DataOutputChecksum
that encapsulate a Checksum
implementor.
checksum
- the Checksum object to encapsulate.Method Detail |
---|
public final void update(byte[] b)
This is equivalent to using update(b, 0, b.length)
.
b
- the datapublic void update(byte[] b, int off, int len)
len
bytes from the specified
byte array, starting from offset off
update
in interface java.util.zip.Checksum
b
- the dataoff
- the offset at which to start reading from the arraylen
- the number of bytes to read from the arraypublic void update(int b)
b
update
in interface java.util.zip.Checksum
b
- the byte.public long getValue()
getValue
in interface java.util.zip.Checksum
public void reset()
reset
in interface java.util.zip.Checksum
public void write(int b)
write
in interface java.io.DataOutput
b
- the byte.public void write(byte[] b)
write
in interface java.io.DataOutput
b
- the bytes.public void write(byte[] b, int off, int len)
write
in interface java.io.DataOutput
b
- the bytesoff
- the offsetlen
- the lengthpublic void writeBoolean(boolean bool)
writeBoolean
in interface java.io.DataOutput
bool
- the boolean value to be written out.public void writeByte(int b)
writeByte
in interface java.io.DataOutput
b
- the byte value to be written out.public void writeShort(int s)
writeShort
in interface java.io.DataOutput
s
- the short value to be written out.public void writeChar(int c)
writeChar
in interface java.io.DataOutput
c
- the char value to be written out.public void writeInt(int i)
writeInt
in interface java.io.DataOutput
i
- the int value to be written out.public void writeLong(long l)
writeLong
in interface java.io.DataOutput
l
- the long value to be written out.public void writeFloat(float f)
writeFloat
in interface java.io.DataOutput
f
- the float value to be written out.public void writeDouble(double d)
writeDouble
in interface java.io.DataOutput
d
- the double value to be written out.public void writeBytes(java.lang.String s)
writeBytes
in interface java.io.DataOutput
s
- the String to be written out as ISO-8859-1.public void writeChars(java.lang.String s)
writeChars
in interface java.io.DataOutput
s
- the String to be written out to the stream.public void writeUTF(java.lang.String s)
writeUTF
in interface java.io.DataOutput
s
- the String to be written out to the stream as UTF-8.public java.util.zip.Checksum getChecksum()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |