Package opendap.dap
Class DString
- java.lang.Object
-
- opendap.dap.DAPNode
-
- opendap.dap.BaseType
-
- opendap.dap.DPrimitive
-
- opendap.dap.DString
-
- All Implemented Interfaces:
Serializable
,Cloneable
,ClientIO
- Direct Known Subclasses:
DURL
public class DString extends DPrimitive implements ClientIO
Holds a OPeNDAPString
value.- See Also:
BaseType
, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class opendap.dap.DAPNode
DAPNode.CloneMap
-
-
Field Summary
-
Fields inherited from class opendap.dap.DAPNode
_nameClear, _nameEncoded, log
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deserialize(DataInputStream source, ServerVersion sv, StatusUI statusUI)
Reads data from aDataInputStream
.void
externalize(DataOutputStream sink)
Writes data to aDataOutputStream
.String
getTypeName()
Returns the OPeNDAP type name of the class instance as aString
.String
getValue()
Get the current value as aString
.void
printConstraint(PrintWriter os)
void
printVal(PrintWriter os, String space, boolean print_decl_p)
Prints the value of the variable, with its declaration.void
setValue(String newVal)
Set the current value.-
Methods inherited from class opendap.dap.BaseType
addAttributeAlias, addAttributeContainer, appendAttribute, appendAttribute, appendAttributeContainer, checkSemantics, checkSemantics, cloneDAG, delAttribute, delAttribute, elementCount, elementCount, getAttribute, getAttribute, getAttributeNames, getAttributeTable, getLongName, hasAttributes, newPrimitiveVector, printAttributes, printAttributes, printAttributes, printAttributes, printDecl, printDecl, printDecl, printDecl, printDecl, printDecl, printDecl, printDecl, printVal, printVal, printVal, printXML, printXML, printXML, printXML, printXML, setClearName
-
Methods inherited from class opendap.dap.DAPNode
clone, cloneDAG, getClearName, getEncodedName, getParent, isProject, setEncodedName, setParent, setProject, setProject, setProjected
-
-
-
-
Constructor Detail
-
DString
public DString()
Constructs a newDString
.
-
DString
public DString(String n)
Constructs a newDString
with namen
.- Parameters:
n
- the name of the variable.
-
-
Method Detail
-
getValue
public final String getValue()
Get the current value as aString
.- Returns:
- the current value.
-
setValue
public final void setValue(String newVal)
Set the current value.- Parameters:
newVal
- the new value.
-
getTypeName
public String getTypeName()
Returns the OPeNDAP type name of the class instance as aString
.- Specified by:
getTypeName
in classBaseType
- Returns:
- the OPeNDAP type name of the class instance as a
String
.
-
printVal
public void printVal(PrintWriter os, String space, boolean print_decl_p)
Prints the value of the variable, with its declaration. This function is primarily intended for debugging OPeNDAP applications and text-based clients such as geturl.- Specified by:
printVal
in classBaseType
- Parameters:
os
- thePrintWriter
on which to print the value.space
- this value is passed to theprintDecl
method, and controls the leading spaces of the output.print_decl_p
- a boolean value controlling whether the variable declaration is printed as well as the value.- See Also:
BaseType.printVal(PrintWriter, String, boolean)
-
deserialize
public void deserialize(DataInputStream source, ServerVersion sv, StatusUI statusUI) throws IOException, EOFException, DataReadException
Reads data from aDataInputStream
. This method is only used on the client side of the OPeNDAP client/server connection.- Specified by:
deserialize
in interfaceClientIO
- Parameters:
source
- aDataInputStream
to read from.sv
- theServerVersion
returned by the server.statusUI
- theStatusUI
object to use for GUI updates and user cancellation notification (may be null).- Throws:
EOFException
- if EOF is found before the variable is completely deserialized.IOException
- thrown on any other InputStream exception.DataReadException
- if a negative string length was read.- See Also:
ClientIO.deserialize(DataInputStream, ServerVersion, StatusUI)
-
externalize
public void externalize(DataOutputStream sink) throws IOException
Writes data to aDataOutputStream
. This method is used primarily by GUI clients which need to download OPeNDAP data, manipulate it, and then re-save it as a binary file.- Specified by:
externalize
in interfaceClientIO
- Parameters:
sink
- aDataOutputStream
to write to.- Throws:
IOException
- thrown on anyOutputStream
exception.
-
printConstraint
public void printConstraint(PrintWriter os)
- Overrides:
printConstraint
in classBaseType
-
-