FileDocCategorySizeDatePackage
MsqlInputStream.javaAPI DocExample2325Tue Jan 01 00:00:00 GMT 1980COM.imaginary.sql.msql

MsqlInputStream

public class MsqlInputStream extends Object
The MsqlInputStream class handles communication between the mSQL database and the JDBC implementation.
Last modified 97/04/19
version
@(#) MsqlInputStream.java 1.3@(#)
author
George Reese (borg@imaginary.com)

Fields Summary
private DataInputStream
input
Constructors Summary
public MsqlInputStream(InputStream in)
Constructs an MsqlInputStream using an InputStream from a socket connecting the driver to the database.

param
in the InputStream representing data form the database
exception
java.io.IOException an error occurred creating a DataInputStream for the InputStream

	super();
	input = new DataInputStream(new BufferedInputStream(in));
    
Methods Summary
public voidclose()
Closes the stream.

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

	input.close();
    
public byte[]read()
Reads data from the mSQL database as an array of bytes.

return
data from the database as an array of bytes
exception
java.io.IOException an error occured on read

	byte[] bytes;
	int size = 0;

	for(int i=0; i<4; i++) {
	    int b = input.read();
	    
	    if( i > 0 ) {
		size += b<<(i*8);
	    }
	    else {
		size += b;
	    }
	}
	bytes = new byte[size];
	input.readFully(bytes);
	return bytes;
    
public java.lang.StringreadAsciiString()
Instead of reading data raw, you can read it as a string using the ASCII character set.

return
the string from the database
exception
java.io.IOException an error occurred on read

	return new String(read(), "8859_9");
    
public java.lang.StringreadUnicodeString()
Instead of reading data raw, you can read it using the Unicode character set. Right now this is likely to give you nonsense.

return
a string from the database
exception
java.io.IOException an error occurred on read

	return new String(read(), "Unicode");