01: /*
02: * This file or a portion of this file is licensed under the terms of
03: * the Globus Toolkit Public License, found in file GTPL, or at
04: * http://www.globus.org/toolkit/download/license.html. This notice must
05: * appear in redistributions of this file, with or without modification.
06: *
07: * Redistributions of this Software, with or without modification, must
08: * reproduce the GTPL in: (1) the Software, or (2) the Documentation or
09: * some other similar material which is provided with the Software (if
10: * any).
11: *
12: * Copyright 1999-2004 University of Chicago and The University of
13: * Southern California. All rights reserved.
14: */
15: package org.griphyn.vdl.invocation;
16:
17: import java.util.*;
18: import java.io.Writer;
19: import java.io.IOException;
20:
21: /**
22: * This class is the base class for a file object.
23: *
24: * @author Jens-S. Vöckler
25: * @author Yong Zhao
26: * @version $Revision: 50 $
27: */
28: public abstract class File extends Invocation implements HasText {
29: /**
30: * optional first 16 byte of file, or less if shorter.
31: */
32: protected String m_hexbyte;
33:
34: /**
35: * Default c'tor: Construct a hollow shell and allow further
36: * information to be added later.
37: */
38: public File() {
39: m_hexbyte = null;
40: }
41:
42: /**
43: * C'tor: Constructs the value in the base class.
44: * @param value is all or part of the hex bytes.
45: */
46: public File(String value) {
47: m_hexbyte = value;
48: }
49:
50: /**
51: * Appends a piece of text to the existing text.
52: * @param fragment is a piece of text to append to existing text.
53: * Appending <code>null</code> is a noop.
54: */
55: public void appendValue(String fragment) {
56: if (fragment != null) {
57: if (this .m_hexbyte == null)
58: this .m_hexbyte = new String(fragment);
59: else
60: this .m_hexbyte += fragment;
61: }
62: }
63:
64: /**
65: * Accessor
66: *
67: * @see #setValue(String)
68: */
69: public String getValue() {
70: return this .m_hexbyte;
71: }
72:
73: /**
74: * Accessor.
75: *
76: * @param hexbyte
77: * @see #getValue()
78: */
79: public void setValue(String hexbyte) {
80: this .m_hexbyte = hexbyte;
81: }
82:
83: /**
84: * Converts the active state into something meant for human consumption.
85: * The method will be called when recursively traversing the instance
86: * tree.
87: *
88: * @param stream is a stream opened and ready for writing. This can also
89: * be a string stream for efficient output.
90: */
91: public void toString(Writer stream) throws IOException {
92: throw new IOException(
93: "method not implemented, please contact vds-support@griphyn.org");
94: }
95: }
|