DexDataWriter extends BufferedOutputStream { public void writeShort(int value) throws IOException { if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) { throw new ExceptionWithContext("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 testWriteShort() throws IOException { writer.writeShort(0); writer.writeShort(0x1122); writer.writeShort(-0x1122); writer.writeShort(0x7FFF); writer.writeShort(-0x8000); expectData(0x00, 0x00, 0x22, 0x11, 0xDE, 0xEE, 0xFF, 0x7F, 0x00, 0x80); }
@Test(expected=ExceptionWithContext.class) public void testWriteShortOutOfBounds() throws IOException { writer.writeShort(0x8000); }
@Test(expected=ExceptionWithContext.class) public void testWriteShortOutOfBounds2() throws IOException { writer.writeShort(-0x8001); }