DexDataWriter extends BufferedOutputStream { public void writeUshort(int value) throws IOException { if (value < 0 || value > 0xFFFF) { throw new ExceptionWithContext("Unsigned short value out of range: %d", value); } write(value); write(value >> 8); } DexDataWriter(@Nonnull OutputStream output, int filePosition);  DexDataWriter(@Nonnull OutputStream output, int filePosition, int bufferSize); @Override void write(int b); @Override void write(byte[] b); @Override void write(byte[] b, int off, int len); void writeLong(long value); static void writeInt(OutputStream out, int value); void writeInt(int value); void writeShort(int value); void writeUshort(int value); void writeUbyte(int value); static void writeUleb128(OutputStream out, int value); void writeUleb128(int value); static void writeSleb128(OutputStream out, int value); void writeSleb128(int value); void writeEncodedValueHeader(int valueType, int valueArg); void writeEncodedInt(int valueType, int value); void writeEncodedLong(int valueType, long value); void writeEncodedUint(int valueType, int value); void writeEncodedFloat(int valueType, float value); void writeEncodedDouble(int valueType, double value); void writeString(String string); void align(); int getPosition();  }
@Test public void testWriteUshort() throws IOException { writer.writeUshort(0); writer.writeUshort(0x1122); writer.writeUshort(0x8899); writer.writeUshort(0xFFFF); expectData(0x00, 0x00, 0x22, 0x11, 0x99, 0x88, 0xFF, 0xFF); }
@Test(expected=ExceptionWithContext.class) public void testWriteUshortOutOfBounds() throws IOException { writer.writeUshort(-1); }
@Test(expected=ExceptionWithContext.class) public void testWriteUshortOutOfBounds2() throws IOException { writer.writeUshort(0x10000); }