1 | /*
|
---|
2 | * Copyright 2000-2002,2004 The Apache Software Foundation
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | *
|
---|
16 | */
|
---|
17 | package org.apache.tools.ant.taskdefs.optional.depend.constantpool;
|
---|
18 |
|
---|
19 | import java.io.DataInputStream;
|
---|
20 | import java.io.IOException;
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * A UTF8 Constant Pool Entry.
|
---|
24 | *
|
---|
25 | */
|
---|
26 | public class Utf8CPInfo extends ConstantPoolEntry {
|
---|
27 | /** The String value of the UTF-8 entry */
|
---|
28 | private String value;
|
---|
29 |
|
---|
30 | /** Constructor. */
|
---|
31 | public Utf8CPInfo() {
|
---|
32 | super(CONSTANT_UTF8, 1);
|
---|
33 | }
|
---|
34 |
|
---|
35 | /**
|
---|
36 | * read a constant pool entry from a class stream.
|
---|
37 | *
|
---|
38 | * @param cpStream the DataInputStream which contains the constant pool
|
---|
39 | * entry to be read.
|
---|
40 | * @exception IOException if there is a problem reading the entry from
|
---|
41 | * the stream.
|
---|
42 | */
|
---|
43 | public void read(DataInputStream cpStream) throws IOException {
|
---|
44 | value = cpStream.readUTF();
|
---|
45 | }
|
---|
46 |
|
---|
47 | /**
|
---|
48 | * Print a readable version of the constant pool entry.
|
---|
49 | *
|
---|
50 | * @return the string representation of this constant pool entry.
|
---|
51 | */
|
---|
52 | public String toString() {
|
---|
53 | return "UTF8 Value = " + value;
|
---|
54 | }
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * Get the string value of the UTF-8 entry
|
---|
58 | *
|
---|
59 | * @return the UTF-8 value as a Java string
|
---|
60 | */
|
---|
61 | public String getValue() {
|
---|
62 | return value;
|
---|
63 | }
|
---|
64 |
|
---|
65 | }
|
---|
66 |
|
---|