FileDocCategorySizeDatePackage
MsqlOutputStream.javaAPI DocExample2209Tue Jan 01 00:00:00 GMT 1980COM.imaginary.sql.msql

MsqlOutputStream

public class MsqlOutputStream extends Object
Represents a stream of data going to the mSQL database.
Last modified 97/04/19
version
@(#) MsqlOutputStream.java 1.3@(#)
author
George Reese (borg@imaginary.com)

Fields Summary
private DataOutputStream
output
Constructors Summary
public MsqlOutputStream(OutputStream out)
Constructs a new MsqlOutputStream using the specified OutputStream.

param
out the OutputStream to be used
exception
java.io.IOException an error occurred creating a DataOutputStream

	super();
	output = new DataOutputStream(new BufferedOutputStream(out));
    
Methods Summary
public voidclose()
Closes the output stream.

exception
java.io.IOException an error occurred on close

	output.close();
    
public voidflush()
Flushes the output queue.

exception
java.io.IOException an error occurred flushing the stream

	output.flush();
    
public voidwrite(byte[] bytes)
Writes some data out to the mSQL database.

param
bytes an array of bytes to be written to the database
exception
java.io.IOException an error occurred on write

	int size = bytes.length;
	
	for(int i=0; i<4; i++) {
	    output.write(size);
	    size >>>= 8;
	}
	output.write(bytes, 0, bytes.length);
	output.flush();
    
public voidwriteAsciiString(java.lang.String str)
Writes a string out as ASCII to the mSQL database.

param
str the string to be written
exception
java.io.IOException an error occurred on write

	write(str.getBytes("8859_9"));
    
public voidwriteUnicodeString(java.lang.String str)
Writes a string out as Unicode to the mSQL database.

param
str the string to be written
exception
java.io.IOException an error occurred on write

	write(str.getBytes("Unicode"));