예제 #1
0
 public void writeArray(Collection<? extends EncodedValue> elements) throws IOException {
   writer.writeEncodedValueHeader(ValueType.ARRAY, 0);
   writer.writeUleb128(elements.size());
   for (EncodedValue element : elements) {
     writeEncodedValue(element);
   }
 }
예제 #2
0
  public void writeAnnotation(
      TypeKey annotationType, Collection<? extends AnnotationElement> elements) throws IOException {
    writer.writeEncodedValueHeader(ValueType.ANNOTATION, 0);
    writer.writeUleb128(typeSection.getItemIndex(annotationType));
    writer.writeUleb128(elements.size());

    Collection<? extends AnnotationElement> sortedElements =
        Ordering.from(BaseAnnotationElement.BY_NAME).immutableSortedCopy(elements);

    for (AnnotationElement element : sortedElements) {
      writer.writeUleb128(stringSection.getItemIndex(annotationSection.getElementName(element)));
      writeEncodedValue(annotationSection.getElementValue(element));
    }
  }
예제 #3
0
 public void writeString(@Nonnull StringKey value) throws IOException {
   writer.writeEncodedUint(ValueType.STRING, stringSection.getItemIndex(value));
 }
예제 #4
0
 public void writeType(@Nonnull TypeKey value) throws IOException {
   writer.writeEncodedUint(ValueType.TYPE, typeSection.getItemIndex(value));
 }
예제 #5
0
 public void writeNull() throws IOException {
   writer.write(ValueType.NULL);
 }
예제 #6
0
 public void writeShort(int value) throws IOException {
   writer.writeEncodedInt(ValueType.SHORT, value);
 }
예제 #7
0
 public void writeLong(long value) throws IOException {
   writer.writeEncodedLong(ValueType.LONG, value);
 }
예제 #8
0
 public void writeMethod(@Nonnull MethodRefKey value) throws IOException {
   writer.writeEncodedUint(ValueType.METHOD, methodSection.getItemIndex(value));
 }
예제 #9
0
 public void writeFloat(float value) throws IOException {
   writer.writeEncodedFloat(ValueType.FLOAT, value);
 }
예제 #10
0
 public void writeInt(int value) throws IOException {
   writer.writeEncodedInt(ValueType.INT, value);
 }
예제 #11
0
 public void writeField(@Nonnull FieldRefKey value) throws IOException {
   writer.writeEncodedUint(ValueType.FIELD, fieldSection.getItemIndex(value));
 }
예제 #12
0
 public void writeDouble(double value) throws IOException {
   writer.writeEncodedDouble(ValueType.DOUBLE, value);
 }
예제 #13
0
 public void writeChar(char value) throws IOException {
   writer.writeEncodedUint(ValueType.CHAR, value);
 }
예제 #14
0
 public void writeByte(byte value) throws IOException {
   writer.writeEncodedInt(ValueType.BYTE, value);
 }
예제 #15
0
 public void writeBoolean(boolean value) throws IOException {
   writer.writeEncodedValueHeader(ValueType.BOOLEAN, value ? 1 : 0);
 }