public void writeBoolean(boolean value) throws IOException { writer.writeEncodedValueHeader(ValueType.BOOLEAN, value ? 1 : 0); }
public void writeBoolean(boolean value) throws IOException { writer.writeEncodedValueHeader(ValueType.BOOLEAN, value ? 1 : 0); }
public void writeBoolean(boolean value) throws IOException { writer.writeEncodedValueHeader(ValueType.BOOLEAN, value ? 1 : 0); }
protected void writeRightZeroExtendedInt(int valueType, int value) throws IOException { int index = 3; do { tempBuf[index--] = (byte)((value & 0xFF000000) >>> 24); value <<= 8; } while (value != 0); int firstElement = index+1; int encodedLength = 4-firstElement; writeEncodedValueHeader(valueType, encodedLength - 1); write(tempBuf, firstElement, encodedLength); }
protected void writeRightZeroExtendedLong(int valueType, long value) throws IOException { int index = 7; do { tempBuf[index--] = (byte)((value & 0xFF00000000000000L) >>> 56); value <<= 8; } while (value != 0); int firstElement = index+1; int encodedLength = 8-firstElement; writeEncodedValueHeader(valueType, encodedLength - 1); write(tempBuf, firstElement, encodedLength); }
protected void writeRightZeroExtendedLong(int valueType, long value) throws IOException { int index = 7; do { tempBuf[index--] = (byte)((value & 0xFF00000000000000L) >>> 56); value <<= 8; } while (value != 0); int firstElement = index+1; int encodedLength = 8-firstElement; writeEncodedValueHeader(valueType, encodedLength - 1); write(tempBuf, firstElement, encodedLength); }
public void writeEncodedUint(int valueType, int value) throws IOException { int index = 0; do { tempBuf[index++] = (byte)value; value >>>= 8; } while (value != 0); writeEncodedValueHeader(valueType, index-1); write(tempBuf, 0, index); }
protected void writeRightZeroExtendedLong(int valueType, long value) throws IOException { int index = 7; do { tempBuf[index--] = (byte)((value & 0xFF00000000000000L) >>> 56); value <<= 8; } while (value != 0); int firstElement = index+1; int encodedLength = 8-firstElement; writeEncodedValueHeader(valueType, encodedLength - 1); write(tempBuf, firstElement, encodedLength); }
protected void writeRightZeroExtendedInt(int valueType, int value) throws IOException { int index = 3; do { tempBuf[index--] = (byte)((value & 0xFF000000) >>> 24); value <<= 8; } while (value != 0); int firstElement = index+1; int encodedLength = 4-firstElement; writeEncodedValueHeader(valueType, encodedLength - 1); write(tempBuf, firstElement, encodedLength); }
public void writeEncodedUint(int valueType, int value) throws IOException { int index = 0; do { tempBuf[index++] = (byte)value; value >>>= 8; } while (value != 0); writeEncodedValueHeader(valueType, index-1); write(tempBuf, 0, index); }
public void writeEncodedUint(int valueType, int value) throws IOException { int index = 0; do { tempBuf[index++] = (byte)value; value >>>= 8; } while (value != 0); writeEncodedValueHeader(valueType, index-1); write(tempBuf, 0, index); }
protected void writeRightZeroExtendedInt(int valueType, int value) throws IOException { int index = 3; do { tempBuf[index--] = (byte)((value & 0xFF000000) >>> 24); value <<= 8; } while (value != 0); int firstElement = index+1; int encodedLength = 4-firstElement; writeEncodedValueHeader(valueType, encodedLength - 1); write(tempBuf, firstElement, encodedLength); }
public void writeEncodedLong(int valueType, long value) throws IOException { int index = 0; if (value >= 0) { while (value > 0x7f) { tempBuf[index++] = (byte)value; value >>= 8; } } else { while (value < -0x80) { tempBuf[index++] = (byte)value; value >>= 8; } } tempBuf[index++] = (byte)value; writeEncodedValueHeader(valueType, index-1); write(tempBuf, 0, index); }
public void writeArray(Collection<? extends EncodedValue> elements) throws IOException { writer.writeEncodedValueHeader(ValueType.ARRAY, 0); writer.writeUleb128(elements.size()); for (EncodedValue element: elements) { writeEncodedValue(element); } }
public void writeArray(Collection<? extends EncodedValue> elements) throws IOException { writer.writeEncodedValueHeader(ValueType.ARRAY, 0); writer.writeUleb128(elements.size()); for (EncodedValue element: elements) { writeEncodedValue(element); } }
public void writeArray(Collection<? extends EncodedValue> elements) throws IOException { writer.writeEncodedValueHeader(ValueType.ARRAY, 0); writer.writeUleb128(elements.size()); for (EncodedValue element: elements) { writeEncodedValue(element); } }
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)); } }
@Test public void testWriteEncodedValueHeader() throws IOException { writer.writeEncodedValueHeader(0x2, 0x1); expectData(0x22); }
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)); } }
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()); for (AnnotationElement element: elements) { writer.writeUleb128(stringSection.getItemIndex(annotationSection.getElementName(element))); writeEncodedValue(annotationSection.getElementValue(element)); } }