01: // Copyright (c) 1997 Per M.A. Bothner.
02: // This is free software; for terms and warranty disclaimer see ./COPYING.
03:
04: package gnu.bytecode;
05:
06: import java.io.*;
07:
08: /* Represents a generic uninterpreted or unknown attribute.
09: * @author Per Bothner
10: */
11:
12: public class MiscAttr extends Attribute {
13: public byte[] data;
14: int offset;
15: int length;
16:
17: public MiscAttr(String name, byte[] data, int offset, int length) {
18: super (name);
19: this .data = data;
20: this .offset = offset;
21: this .length = length;
22: }
23:
24: public MiscAttr(String name, byte[] data) {
25: this (name, data, 0, data.length);
26: }
27:
28: public MiscAttr(String name) {
29: this (name, nobytes, 0, 0);
30: }
31:
32: private static final byte[] nobytes = new byte[0];
33:
34: public static Attribute synthetic() {
35: return new MiscAttr("Synthetic");
36: }
37:
38: public int getLength() {
39: return length;
40: }
41:
42: public void write(DataOutputStream dstr) throws java.io.IOException {
43: dstr.write(data, offset, length);
44: }
45:
46: }
|