opendap/src/main/java/opendap/dap/DString.java
public void externalize(DataOutputStream sink) throws IOException {
        // convert String to a byte array 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 {
            byte byteArray[] = val.getBytes("ISO8859_1");
            sink.writeInt(byteArray.length);
            int modFour = byteArray.length % 4;
            // number of bytes to pad
            int pad = (modFour != 0) ? (4 - modFour) : 0;
            sink.write(byteArray, 0, byteArray.length);
            for (int i = 0; i < pad; i++) {
                sink.writeByte(0);
            }
        }
        catch (UnsupportedEncodingException e) {
            // this should never happen
            throw new UnsupportedEncodingException("ISO8859_1 encoding not supported by this VM!");
        }
    }
public void externalize(DataOutputStream sink) throws IOException {
        // convert String to a byte array 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 {
            byte byteArray[] = val.getBytes("ISO8859_1");
            sink.writeInt(byteArray.length);
            int modFour = byteArray.length % 4;
            // number of bytes to pad
            int pad = (modFour != 0) ? (4 - modFour) : 0;
            sink.write(byteArray, 0, byteArray.length);
            for (int i = 0; i < pad; i++) {
                sink.writeByte(0);
            }
        }
        catch (UnsupportedEncodingException e) {
            // this should never happen
            throw new UnsupportedEncodingException("ISO8859_1 encoding not supported by this VM!");
        }
    }
public void externalize ( DataOutputStream sink ) throws IOException { // convert String to a byte array 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 { byte byteArray [ ] = val . getBytes ( "ISO8859_1" ) ; sink . writeInt ( byteArray . length ) ; int modFour = byteArray . length % 4 ; // number of bytes to pad
 int pad = ( modFour != 0 ) ? ( 4 - modFour ) : 0 ; sink . write ( byteArray , 0 , byteArray . length ) ; for ( int i = 0 ; i < pad ; i ++ ) { sink . writeByte ( 0 ) ; } } catch ( UnsupportedEncodingException e ) { // this should never happen
 throw new UnsupportedEncodingException ( "ISO8859_1 encoding not supported by this VM!" ) ; } }
Writes data to a <code>DataOutputStream</code>. 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.

@param sink a <code>DataOutputStream</code> to write to.
@throws IOException thrown on any <code>OutputStream</code>
exception.
Writes data to a <code > DataOutputStream< / code > . 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 .