1 23 24 25 package com.sun.jdo.api.persistence.enhancer.classfile; 26 27 import java.io.*; 28 29 34 35 public class GenericAttribute extends ClassAttribute { 36 37 38 byte attributeBytes[]; 39 40 41 42 45 public GenericAttribute(ConstUtf8 attrName, byte attrBytes[]) { 46 super(attrName); 47 attributeBytes = attrBytes; 48 } 49 50 void write(DataOutputStream out) throws IOException { 51 out.writeShort(attrName().getIndex()); 52 out.writeInt(attributeBytes.length); 53 out.write(attributeBytes, 0, attributeBytes.length); 54 } 55 56 void print(PrintStream out, int indent) { 57 ClassPrint.spaces(out, indent); 58 out.println("Generic Attribute(" + attrName().asString() + "): " + Integer.toString(attributeBytes.length) + 60 " in length"); for (int i=0; i<attributeBytes.length; i++) { 62 if ((i % 16) == 0) { 63 if (i != 0) 64 out.println(); 65 out.print(i + " :"); } 67 out.print(" " + Integer.toString((attributeBytes[i] & 0xff), 16)); } 69 out.println(); 70 } 71 } 72 73 | Popular Tags |