123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- package me.hammerle.snuviengine.util;
- import java.io.IOException;
- import java.io.OutputStream;
- public class WrappedOutputStream
- {
- private final OutputStream out;
-
- public WrappedOutputStream(OutputStream out)
- {
- this.out = out;
- }
-
- public void writeByte(int b) throws IOException
- {
- out.write(b);
- }
-
- public void writeUnsignedByte(int b) throws IOException
- {
- out.write(b);
- }
-
- public void writeShort(int s) throws IOException
- {
- out.write(s & 0xFF);
- out.write((s >> 8) & 0xFF);
- }
-
- public void writeInt(int i) throws IOException
- {
- out.write(i & 0xFF);
- out.write((i >> 8) & 0xFF);
- out.write((i >> 16) & 0xFF);
- out.write((i >> 24) & 0xFF);
- }
-
- public void writeLong(long l) throws IOException
- {
- 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));
- }
-
- public void writeString(String s) throws IOException
- {
- byte[] b = s.getBytes();
- writeInt(b.length);
- out.write(b);
- }
- }
|