@Override public void write(char[] chars) throws IOException { //synchronized(lock) { for (char chr: chars) { write(chr); } //} }
@Override public void write(char[] chars, int start, int len) throws IOException { //synchronized(lock) { len = start+len; while (start < len) { write(chars[start++]); } //} }
@Override public Writer append(char c) throws IOException { write(c); return this; }
public void printUnsignedLongAsHex(long value) throws IOException { int bufferIndex = 0; do { int digit = (int)(value & 15); if (digit < 10) { buffer[bufferIndex++] = (char)(digit + '0'); } else { buffer[bufferIndex++] = (char)((digit - 10) + 'a'); } value >>>= 4; } while (value != 0); while (bufferIndex>0) { write(buffer[--bufferIndex]); } }
protected boolean writeCommentIfResourceId(IndentingWriter writer, int val) throws IOException { Map<Integer,String> resourceIds = methodDef.classDef.options.resourceIds; String resource = resourceIds.get(Integer.valueOf(val)); if (resource != null) { writer.write(" # "); writer.write(resource); return true; } return false; }
@Override public void write(String str, int start, int len) throws IOException { //synchronized(lock) { len = start+len; while (start < len) { write(str.charAt(start++)); } //} }
@Override public Writer append(CharSequence charSequence) throws IOException { write(charSequence.toString()); return this; }
protected void writeCommentIfLikelyDouble(IndentingWriter writer, long val) throws IOException { if (NumberUtils.isLikelyDouble(val)) { writer.write(" # "); double dval = Double.longBitsToDouble(val); if (dval == Double.POSITIVE_INFINITY) writer.write("Double.POSITIVE_INFINITY"); else if (dval == Double.NEGATIVE_INFINITY) writer.write("Double.NEGATIVE_INFINITY"); else if (Double.isNaN(dval)) writer.write("Double.NaN"); else if (dval == Double.MAX_VALUE) writer.write("Double.MAX_VALUE"); else if (dval == Math.PI) writer.write("Math.PI"); else if (dval == Math.E) writer.write("Math.E"); else writer.write(Double.toString(dval)); } }
protected void writeCommentIfLikelyFloat(IndentingWriter writer, int val) throws IOException { if (NumberUtils.isLikelyFloat(val)) { writer.write(" # "); float fval = Float.intBitsToFloat(val); if (fval == Float.POSITIVE_INFINITY) writer.write("Float.POSITIVE_INFINITY"); else if (fval == Float.NEGATIVE_INFINITY) writer.write("Float.NEGATIVE_INFINITY"); else if (Float.isNaN(fval)) writer.write("Float.NaN"); else if (fval == Float.MAX_VALUE) writer.write("Float.MAX_VALUE"); else if (fval == (float)Math.PI) writer.write("(float)Math.PI"); else if (fval == (float)Math.E) writer.write("(float)Math.E"); else { writer.write(Float.toString(fval)); writer.write('f'); } } }
@Override public void write(String s) throws IOException { //synchronized (lock) { for (int i=0; i<s.length(); i++) { write(s.charAt(i)); } //} }
@Override public Writer append(CharSequence charSequence, int start, int len) throws IOException { write(charSequence.subSequence(start, len).toString()); return this; }
@Override public boolean writeTo(IndentingWriter writer) throws IOException { writer.write("#@"); writer.printUnsignedLongAsHex(codeAddress & 0xFFFFFFFFL); return true; } });
@Override public boolean writeTo(IndentingWriter writer) throws IOException { writer.write("#@"); writer.printUnsignedLongAsHex(codeAddress & 0xFFFFFFFFL); return true; } });
protected void writeOpcode(IndentingWriter writer) throws IOException { writer.write(instruction.getOpcode().name); }
protected void writeVtableIndex(IndentingWriter writer) throws IOException { writer.write("vtable@"); writer.printSignedIntAsDec(((VtableIndexInstruction)instruction).getVtableIndex()); } }
protected void writeFieldOffset(IndentingWriter writer) throws IOException { writer.write("field@0x"); writer.printUnsignedLongAsHex(((FieldOffsetInstruction)instruction).getFieldOffset()); }
protected void writeInlineIndex(IndentingWriter writer) throws IOException { writer.write("inline@"); writer.printSignedIntAsDec(((InlineIndexInstruction)instruction).getInlineIndex()); }
protected void writeInvokeRangeRegisters(IndentingWriter writer) throws IOException { RegisterRangeInstruction instruction = (RegisterRangeInstruction)this.instruction; int regCount = instruction.getRegisterCount(); if (regCount == 0) { writer.write("{}"); } else { int startRegister = instruction.getStartRegister(); methodDef.registerFormatter.writeRegisterRange(writer, startRegister, startRegister+regCount-1); } }