You can write Java primitive data directly to a DataOutputStream. DataOutputStream is an example of a filtered stream. A filtered stream wraps another stream to either provide additional functionality or to alter the data along the way. The base filtered stream classes are FilteredOutputStream, FilteredInputStream, FilteredWriter, and FilteredReader. The filter in DataOutputStream provides methods to output each Java primitive type: writeBoolean, writeDouble, and so on. It also provides the writeUTF method to output a String. |