be.SIRAPRISE.util
Class MyDataOutputStream
java.lang.Object
be.SIRAPRISE.util.MyDataOutputStream
public class MyDataOutputStream
- extends java.lang.Object
- Author:
- Erwin Smout
Method Summary |
static int |
writeBigUTF(java.lang.String str,
java.io.DataOutput out)
Writes a string to the specified DataOutput using Java modified UTF-8 encoding in a machine-independent manner. |
static int |
writeSmallUTF(java.lang.String str,
java.io.DataOutput out)
Writes a string to the specified DataOutput using Java modified UTF-8 encoding in a machine-independent manner. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MyDataOutputStream
public MyDataOutputStream()
writeBigUTF
public static int writeBigUTF(java.lang.String str,
java.io.DataOutput out)
throws java.io.IOException
- Writes a string to the specified DataOutput using Java modified UTF-8 encoding in a machine-independent manner.
First, four bytes are written to out as if by the writeInt
method giving the number of bytes to follow. This value is the number of bytes actually written out, not the length of the string. Following the length, each character of the string is output, in sequence, using the modified UTF-8 encoding for the character. If no exception is thrown, the counter written
is incremented by the total number of bytes written to the output stream. This will be at least four plus the length of str
, and at most two plus thrice the length of str
.
- Parameters:
str
- a string to be written.out
- destination to write to
- Returns:
- The number of bytes written out.
- Throws:
java.io.IOException
- if an I/O error occurs.
writeSmallUTF
public static int writeSmallUTF(java.lang.String str,
java.io.DataOutput out)
throws java.io.IOException
- Writes a string to the specified DataOutput using Java modified UTF-8 encoding in a machine-independent manner.
First, two bytes are written to out as if by the writeInt
method giving the number of bytes to follow. This value is the number of bytes actually written out, not the length of the string. Following the length, each character of the string is output, in sequence, using the modified UTF-8 encoding for the character. If no exception is thrown, the counter written
is incremented by the total number of bytes written to the output stream. This will be at least four plus the length of str
, and at most two plus thrice the length of str
.
- Parameters:
str
- a string to be written.out
- destination to write to
- Returns:
- The number of bytes written out.
- Throws:
java.io.IOException
- if an I/O error occurs.