FileDocCategorySizeDatePackage
TestBinaryOutputStream.javaAPI DocExample799Sun Feb 24 10:30:14 GMT 2002None

TestBinaryOutputStream

public class TestBinaryOutputStream extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

		// Set up the streams
		File outFile = new File("C:\\Sample1.dat");
		
		// FileOutputStream writes bytes
		FileOutputStream ofs = new FileOutputStream(outFile);
		
		// DataOuputStream writes floats, ints, doubles
		DataOutputStream outDataStream = new DataOutputStream(ofs);
		
		// Try writing a few primitive values to the stream.
		outDataStream.writeInt(4);
		outDataStream.writeInt(-1);
                String s = "Hello world";
                outDataStream.writeUTF(s);
                outDataStream.writeDouble(3.14159D);
                outDataStream.writeLong(1000L);
                outDataStream.writeChar('A");
		outDataStream.close();