Package com.tangosol.io
Class DebugDataOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
com.tangosol.io.DebugDataOutputStream
- All Implemented Interfaces:
com.oracle.coherence.common.io.OutputStreaming
,OutputStreaming
,Closeable
,DataOutput
,Flushable
,AutoCloseable
public class DebugDataOutputStream
extends FilterOutputStream
implements DataOutput, OutputStreaming
This is an imitation DataOutputStream class that logs the output in a
human-readable format for debugging purposes. All output will be
- Author:
- cp 2004.08.06
-
Field Summary
Fields inherited from class java.io.FilterOutputStream
out
-
Constructor Summary
ConstructorDescriptionDebugDataOutputStream
(OutputStream stream) Construct a DebugDataOutputStream that will output to the specified Stream object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes this OutputStream and releases any associated system resources.void
flush()
Flushes this OutputStream and forces any buffered output bytes to be written.static void
Command line test.protected void
Print the passed String to the underlying stream.void
write
(byte[] ab) Writes all the bytes in the arrayab
.void
write
(byte[] ab, int of, int cb) Writescb
bytes starting at offsetof
from the arrayab
.void
write
(int b) Writes the eight low-order bits of the argumentb
.void
writeBoolean
(boolean f) Writes the boolean valuef
.void
writeByte
(int b) Writes the eight low-order bits of the argumentb
.void
writeBytes
(String s) Writes the Strings
, but only the low-order byte from each character of the String is written.void
writeChar
(int ch) Writes a char value, comprised of the 16 low-order bits of the argumentch
; the 16 high-order bits ofch
are ignored.void
writeChars
(String s) Writes the Strings
as a sequence of characters.void
writeDouble
(double dfl) Writes a double value.void
writeFloat
(float fl) Writes a float value.void
writeInt
(int n) Writes an int value.void
writeLong
(long l) Writes a long value.void
writeShort
(int n) Writes a short value, comprised of the 16 low-order bits of the argumentn
; the 16 high-order bits ofn
are ignored.void
Writes the Strings
as a sequence of characters, but using UTF-8 encoding for the characters, and including the String length data so that the correspondingDataInput.readUTF()
method can reconstitute a String from the written data.Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
DebugDataOutputStream
Construct a DebugDataOutputStream that will output to the specified Stream object.- Parameters:
stream
- an OutputStream to write to
-
-
Method Details
-
write
Writes the eight low-order bits of the argumentb
. The 24 high-order bits ofb
are ignored.- Specified by:
write
in interfaceDataOutput
- Specified by:
write
in interfacecom.oracle.coherence.common.io.OutputStreaming
- Overrides:
write
in classFilterOutputStream
- Parameters:
b
- the byte to write (passed as an integer)- Throws:
IOException
- if an I/O error occurs
-
write
Writes all the bytes in the arrayab
.- Specified by:
write
in interfaceDataOutput
- Specified by:
write
in interfacecom.oracle.coherence.common.io.OutputStreaming
- Overrides:
write
in classFilterOutputStream
- Parameters:
ab
- the byte array to write- Throws:
IOException
- if an I/O error occursNullPointerException
- ifab
isnull
-
write
Writescb
bytes starting at offsetof
from the arrayab
.- Specified by:
write
in interfaceDataOutput
- Specified by:
write
in interfacecom.oracle.coherence.common.io.OutputStreaming
- Overrides:
write
in classFilterOutputStream
- Parameters:
ab
- the byte array to write fromof
- the offset intoab
to start writing fromcb
- the number of bytes fromab
to write- Throws:
IOException
- if an I/O error occursNullPointerException
- ifab
isnull
IndexOutOfBoundsException
- ifof
is negative, orcb
is negative, orof+cb
is greater thanab.length
-
writeBoolean
Writes the boolean valuef
.- Specified by:
writeBoolean
in interfaceDataOutput
- Parameters:
f
- the boolean to be written- Throws:
IOException
- if an I/O error occurs
-
writeByte
Writes the eight low-order bits of the argumentb
. The 24 high-order bits ofb
are ignored.- Specified by:
writeByte
in interfaceDataOutput
- Parameters:
b
- the byte to write (passed as an integer)- Throws:
IOException
- if an I/O error occurs
-
writeShort
Writes a short value, comprised of the 16 low-order bits of the argumentn
; the 16 high-order bits ofn
are ignored.- Specified by:
writeShort
in interfaceDataOutput
- Parameters:
n
- the short to write (passed as an integer)- Throws:
IOException
- if an I/O error occurs
-
writeChar
Writes a char value, comprised of the 16 low-order bits of the argumentch
; the 16 high-order bits ofch
are ignored.- Specified by:
writeChar
in interfaceDataOutput
- Parameters:
ch
- the char to write (passed as an integer)- Throws:
IOException
- if an I/O error occurs
-
writeInt
Writes an int value.- Specified by:
writeInt
in interfaceDataOutput
- Parameters:
n
- the int to write- Throws:
IOException
- if an I/O error occurs
-
writeLong
Writes a long value.- Specified by:
writeLong
in interfaceDataOutput
- Parameters:
l
- the long to write- Throws:
IOException
- if an I/O error occurs
-
writeFloat
Writes a float value.- Specified by:
writeFloat
in interfaceDataOutput
- Parameters:
fl
- the float to write- Throws:
IOException
- if an I/O error occurs
-
writeDouble
Writes a double value.- Specified by:
writeDouble
in interfaceDataOutput
- Parameters:
dfl
- the double to write- Throws:
IOException
- if an I/O error occurs
-
writeBytes
Writes the Strings
, but only the low-order byte from each character of the String is written.- Specified by:
writeBytes
in interfaceDataOutput
- Parameters:
s
- the String to write- Throws:
IOException
- if an I/O error occursNullPointerException
- ifs
isnull
-
writeChars
Writes the Strings
as a sequence of characters.- Specified by:
writeChars
in interfaceDataOutput
- Parameters:
s
- the String to write- Throws:
IOException
- if an I/O error occursNullPointerException
- ifs
isnull
-
writeUTF
Writes the Strings
as a sequence of characters, but using UTF-8 encoding for the characters, and including the String length data so that the correspondingDataInput.readUTF()
method can reconstitute a String from the written data.- Specified by:
writeUTF
in interfaceDataOutput
- Parameters:
s
- the String to write- Throws:
IOException
- if an I/O error occursNullPointerException
- ifs
isnull
-
flush
Flushes this OutputStream and forces any buffered output bytes to be written.- Specified by:
flush
in interfaceFlushable
- Specified by:
flush
in interfacecom.oracle.coherence.common.io.OutputStreaming
- Overrides:
flush
in classFilterOutputStream
- Throws:
IOException
- if an I/O error occurs
-
close
Closes this OutputStream and releases any associated system resources.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfacecom.oracle.coherence.common.io.OutputStreaming
- Overrides:
close
in classFilterOutputStream
- Throws:
IOException
- if an I/O error occurs
-
println
Print the passed String to the underlying stream.- Parameters:
s
- the String to print- Throws:
IOException
-
main
Command line test.- Throws:
Exception
-