LittleEndianDataOutputStream extends FilterOutputStream implements DataOutput { @Override public void writeByte(int v) throws IOException { ((DataOutputStream) out).writeByte(v); } LittleEndianDataOutputStream(OutputStream out); @Override void write(byte[] b, int off, int len); @Override void writeBoolean(boolean v); @Override void writeByte(int v); @Override void writeShort(int v); @Override void writeChar(int v); @Override void writeInt(int v); @Override void writeLong(long v); @Override void writeFloat(float v); @Override void writeDouble(double v); @Override void writeBytes(String s); @Override void writeChars(String s); @Override void writeUTF(String str); @Override void close();  }
@Test public void testWriteByte() throws IOException { final ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); final LittleEndianDataOutputStream littleEndianOut = new LittleEndianDataOutputStream(byteOut); littleEndianOut.writeByte(0x01); littleEndianOut.writeByte(0x01); littleEndianOut.writeByte(0x00); littleEndianOut.close(); assertTrue(Arrays.equals(new byte[] {0x01, 0x01, 0x00}, byteOut.toByteArray())); }