Methods Summary |
---|
public int | size()
return this.written;
|
public void | write(int b)
out.write(b);
written++;
|
public void | write(byte[] data, int offset, int length)
out.write(data, offset, length);
written += length;
|
public void | writeBoolean(boolean b)
if (b) this.write(1);
else this.write(0);
|
public void | writeByte(int b)
out.write(b);
written++;
|
public void | writeBytes(java.lang.String s)
int length = s.length();
for (int i = 0; i < length; i++) {
out.write((byte) s.charAt(i));
}
written += length;
|
public void | writeChar(int c)
out.write(c & 0xFF);
out.write((c >>> 8) & 0xFF);
written += 2;
|
public void | writeChars(java.lang.String s)
int length = s.length();
for (int i = 0; i < length; i++) {
int c = s.charAt(i);
out.write(c & 0xFF);
out.write((c >>> 8) & 0xFF);
}
written += length * 2;
|
public final void | writeDouble(double d)
this.writeLong(Double.doubleToLongBits(d));
|
public final void | writeFloat(float f)
this.writeInt(Float.floatToIntBits(f));
|
public void | writeInt(int i)
out.write(i & 0xFF);
out.write((i >>> 8) & 0xFF);
out.write((i >>> 16) & 0xFF);
out.write((i >>> 24) & 0xFF);
written += 4;
|
public void | writeLong(long l)
out.write((int) l & 0xFF);
out.write((int) (l >>> 8) & 0xFF);
out.write((int) (l >>> 16) & 0xFF);
out.write((int) (l >>> 24) & 0xFF);
out.write((int) (l >>> 32) & 0xFF);
out.write((int) (l >>> 40) & 0xFF);
out.write((int) (l >>> 48) & 0xFF);
out.write((int) (l >>> 56) & 0xFF);
written += 8;
|
public void | writeShort(int s)
out.write(s & 0xFF);
out.write((s >>> 8) & 0xFF);
written += 2;
|
public void | writeUTF(java.lang.String s)
int numchars = s.length();
int numbytes = 0;
for (int i = 0 ; i < numchars ; i++) {
int c = s.charAt(i);
if ((c >= 0x0001) && (c <= 0x007F)) numbytes++;
else if (c > 0x07FF) numbytes += 3;
else numbytes += 2;
}
if (numbytes > 65535) throw new UTFDataFormatException();
out.write((numbytes >>> 8) & 0xFF);
out.write(numbytes & 0xFF);
for (int i = 0 ; i < numchars ; i++) {
int c = s.charAt(i);
if ((c >= 0x0001) && (c <= 0x007F)) {
out.write(c);
}
else if (c > 0x07FF) {
out.write(0xE0 | ((c >> 12) & 0x0F));
out.write(0x80 | ((c >> 6) & 0x3F));
out.write(0x80 | (c & 0x3F));
written += 2;
}
else {
out.write(0xC0 | ((c >> 6) & 0x1F));
out.write(0x80 | (c & 0x3F));
written += 1;
}
}
written += numchars + 2;
|