## dods.dap
Class DString

    java.lang.Object
      dods.dap.BaseType
          dods.dap.DString

All Implemented Interfaces:
  ClientIO, Cloneable

Direct Known Subclasses:
  DURL, SDString

public class DString
extends BaseType
implements ClientIO

Holds a DODS `String` value.

See Also:
  `BaseType`

Constructor Summary
`DString()` Constructs a new `DString`.
`DString(String n)` Constructs a new `DString` with name `n`.

Method Summary
`void` `deserialize(DataInputStream source, ServerVersion sv, StatusUI statusUI)` Reads data from a `DataInputStream`.
`void` `externalize(DataOutputStream sink)` Writes data to a `DataOutputStream`.
`String` `getTypeName()` Returns the DODS type name of the class instance as a `String`.
`String` `getValue()` Get the current value as a `String`.
`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 dods.dap.BaseType
`checkSemantics, checkSemantics, clone, elementCount, elementCount, getLongName, getName, getParent, newPrimitiveVector, printDecl, printDecl, printDecl, printDecl, printDecl, printDecl, printDecl, printDecl, printVal, printVal, printVal, setName, setParent`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DString

    public DString()

  Constructs a new `DString`.

### DString

    public DString(String n)

  Constructs a new `DString` with name `n`.

Parameters:
  `n` - the name of the variable.

Method Detail

### getValue

    public final String getValue()

  Get the current value as a `String`.

  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 DODS type name of the class instance as a `String`.

  Specified by:
    `getTypeName` in class `BaseType`
  Returns:
    the DODS 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 DODS applications and text-based clients such as geturl.

  Specified by:
    `printVal` in class `BaseType`
  Parameters:
    `os` - the `PrintWriter` on which to print the value.
    `space` - this value is passed to the `printDecl` 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 a `DataInputStream`. This method is only used on the client side of the DODS client/server connection.

  Specified by:
    `deserialize` in interface `ClientIO`
  Parameters:
    `source` - a `DataInputStream` to read from.
    `sv` - the `ServerVersion` returned by the server.
    `statusUI` - the `StatusUI` 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 a `DataOutputStream`. This method is used primarily by GUI clients which need to download DODS data, manipulate it, and then re-save it as a binary file.

  Specified by:
    `externalize` in interface `ClientIO`
  Parameters:
    `sink` - a `DataOutputStream` to write to.
  Throws:
    `IOException` - thrown on any `OutputStream` exception.