opendap/src/main/java/opendap/dap/DString.java
public synchronized void deserialize(DataInputStream source,
                                         ServerVersion sv,
                                         StatusUI statusUI)
            throws IOException, EOFException, DataReadException {
        int dap_len = source.readInt();

        //LogStream.out.println("DString deserialize string dap_length: "+ dap_len);

        if (dap_len < 0)
            throw new DataReadException("Negative string length (dap_length: "+ dap_len +") read.");
        if (dap_len > Short.MAX_VALUE)
            throw new DataReadException("DString deserialize string length (dap_length: "+ dap_len +") too large.");



        int modFour = dap_len % 4;
        // number of bytes to pad
        int pad = (modFour != 0) ? (4 - modFour) : 0;

        byte byteArray[] = new byte[dap_len];

        // With blackdown JDK1.1.8v3 (comes with matlab 6) read() didn't always
        // finish reading a string.  readFully() insures that it gets all <dap_len>
        // characters it requested.  rph 08/20/01.

        //source.read(byteArray, 0, dap_len);
        source.readFully(byteArray, 0, dap_len);

        // pad out to a multiple of four bytes
        byte unused;
        for (int i = 0; i < pad; i++)
            unused = source.readByte();

        if (statusUI != null)
            statusUI.incrementByteCount(4 + dap_len + pad);

        // convert bytes to a new String using ISO8859_1 (Latin 1) encoding.
        // This was chosen because it converts each byte to its Unicode value
        // with no translation (the first 256 glyphs in Unicode are ISO8859_1)
        try {
            val = new String(byteArray, 0, dap_len, "ISO8859_1");
            hasValue = true;
        }
        catch (UnsupportedEncodingException e) {
            // this should never happen
            throw new UnsupportedEncodingException("ISO8859_1 encoding not supported by this VM!");
        }
    }
public synchronized void deserialize(DataInputStream source,
                                         ServerVersion sv,
                                         StatusUI statusUI)
            throws IOException, EOFException, DataReadException {
        int dap_len = source.readInt();

        //LogStream.out.println("DString deserialize string dap_length: "+ dap_len);

        if (dap_len < 0)
            throw new DataReadException("Negative string length (dap_length: "+ dap_len +") read.");
        if (dap_len > Short.MAX_VALUE)
            throw new DataReadException("DString deserialize string length (dap_length: "+ dap_len +") too large.");



        int modFour = dap_len % 4;
        // number of bytes to pad
        int pad = (modFour != 0) ? (4 - modFour) : 0;

        byte byteArray[] = new byte[dap_len];

        // With blackdown JDK1.1.8v3 (comes with matlab 6) read() didn't always
        // finish reading a string.  readFully() insures that it gets all <dap_len>
        // characters it requested.  rph 08/20/01.

        //source.read(byteArray, 0, dap_len);
        source.readFully(byteArray, 0, dap_len);

        // pad out to a multiple of four bytes
        byte unused;
        for (int i = 0; i < pad; i++)
            unused = source.readByte();

        if (statusUI != null)
            statusUI.incrementByteCount(4 + dap_len + pad);

        // convert bytes to a new String using ISO8859_1 (Latin 1) encoding.
        // This was chosen because it converts each byte to its Unicode value
        // with no translation (the first 256 glyphs in Unicode are ISO8859_1)
        try {
            val = new String(byteArray, 0, dap_len, "ISO8859_1");
            hasValue = true;
        }
        catch (UnsupportedEncodingException e) {
            // this should never happen
            throw new UnsupportedEncodingException("ISO8859_1 encoding not supported by this VM!");
        }
    }
public synchronized void deserialize ( DataInputStream source , ServerVersion sv , StatusUI statusUI ) throws IOException , EOFException , DataReadException { int dap_len = source . readInt ( ) ; //LogStream.out.println("DString deserialize string dap_length: "+ dap_len);
 if ( dap_len < 0 ) throw new DataReadException ( "Negative string length (dap_length: " + dap_len + ") read." ) ; if ( dap_len > Short . MAX_VALUE ) throw new DataReadException ( "DString deserialize string length (dap_length: " + dap_len + ") too large." ) ; int modFour = dap_len % 4 ; // number of bytes to pad
 int pad = ( modFour != 0 ) ? ( 4 - modFour ) : 0 ; byte byteArray [ ] = new byte [ dap_len ] ; // With blackdown JDK1.1.8v3 (comes with matlab 6) read() didn't always
 // finish reading a string.  readFully() insures that it gets all <dap_len>
 // characters it requested.  rph 08/20/01.
 //source.read(byteArray, 0, dap_len);
 source . readFully ( byteArray , 0 , dap_len ) ; // pad out to a multiple of four bytes
 byte unused ; for ( int i = 0 ; i < pad ; i ++ ) unused = source . readByte ( ) ; if ( statusUI != null ) statusUI . incrementByteCount ( 4 + dap_len + pad ) ; // convert bytes to a new String using ISO8859_1 (Latin 1) encoding.
 // This was chosen because it converts each byte to its Unicode value
 // with no translation (the first 256 glyphs in Unicode are ISO8859_1)
 try { val = new String ( byteArray , 0 , dap_len , "ISO8859_1" ) ; hasValue = true ; } catch ( UnsupportedEncodingException e ) { // this should never happen
 throw new UnsupportedEncodingException ( "ISO8859_1 encoding not supported by this VM!" ) ; } }
Reads data from a <code>DataInputStream</code>. This method is only used
on the client side of the OPeNDAP client/server connection.

@param source   a <code>DataInputStream</code> to read from.
@param sv       the <code>ServerVersion</code> returned by the server.
@param statusUI the <code>StatusUI</code> 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.
@throws IOException       thrown on any other InputStream exception.
@throws DataReadException if a negative string length was read.
@see ClientIO#deserialize(DataInputStream, ServerVersion, StatusUI)
Reads data from a <code > DataInputStream< / code > . This method is only used on the client side of the OPeNDAP client / server connection .