All Packages Class Hierarchy This Package Previous Next Index
Class postgresql.PG_Stream
java.lang.Object
|
+----postgresql.PG_Stream
- public class PG_Stream
- extends Object
- See Also:
- Connection
-
PG_Stream(String, int)
- Constructor: Connect to the PostgreSQL back end and return
a stream connection.
-
close()
- Closes the connection
-
flush()
- This flushes any pending output to the backend.
-
Receive(byte[], int, int)
- Reads in a given number of bytes from the backend
-
ReceiveChar()
- Receives a single character from the backend
-
ReceiveInteger(int)
- Receives an integer from the backend
-
ReceiveIntegerR(int)
- Receives an integer from the backend
-
ReceiveString(int)
- Receives a null-terminated string from the backend.
-
ReceiveTuple(int, boolean)
- Read a tuple from the back end.
-
Send(byte[])
- Send an array of bytes to the backend
-
Send(byte[], int)
- Send an exact array of bytes to the backend - if the length
has not been reached, send nulls until it has.
-
Send(byte[], int, int)
- Send an exact array of bytes to the backend - if the length
has not been reached, send nulls until it has.
-
SendChar(int)
- Sends a single character to the back end
-
SendInteger(int, int)
- Sends an integer to the back end
-
SendIntegerReverse(int, int)
- Sends an integer to the back end in reverse order.
-
SendPacket(byte[])
- Sends a packet, prefixed with the packet's length
PG_Stream
public PG_Stream(String host,
int port) throws IOException
- Constructor: Connect to the PostgreSQL back end and return
a stream connection.
- Parameters:
- host - the hostname to connect to
- port - the port number that the postmaster is sitting on
- Throws: IOException
- if an IOException occurs below it.
SendChar
public void SendChar(int val) throws IOException
- Sends a single character to the back end
- Parameters:
- val - the character to be sent
- Throws: IOException
- if an I/O error occurs
SendInteger
public void SendInteger(int val,
int siz) throws IOException
- Sends an integer to the back end
- Parameters:
- val - the integer to be sent
- siz - the length of the integer in bytes (size of structure)
- Throws: IOException
- if an I/O error occurs
SendIntegerReverse
public void SendIntegerReverse(int val,
int siz) throws IOException
- Sends an integer to the back end in reverse order.
This is required when the backend uses the routines in the
src/backend/libpq/pqcomprim.c module.
As time goes by, this should become obsolete.
- Parameters:
- val - the integer to be sent
- siz - the length of the integer in bytes (size of structure)
- Throws: IOException
- if an I/O error occurs
Send
public void Send(byte buf[]) throws IOException
- Send an array of bytes to the backend
- Parameters:
- buf - The array of bytes to be sent
- Throws: IOException
- if an I/O error occurs
Send
public void Send(byte buf[],
int siz) throws IOException
- Send an exact array of bytes to the backend - if the length
has not been reached, send nulls until it has.
- Parameters:
- buf - the array of bytes to be sent
- siz - the number of bytes to be sent
- Throws: IOException
- if an I/O error occurs
Send
public void Send(byte buf[],
int off,
int siz) throws IOException
- Send an exact array of bytes to the backend - if the length
has not been reached, send nulls until it has.
- Parameters:
- buf - the array of bytes to be sent
- off - offset in the array to start sending from
- siz - the number of bytes to be sent
- Throws: IOException
- if an I/O error occurs
SendPacket
public void SendPacket(byte buf[]) throws IOException
- Sends a packet, prefixed with the packet's length
- Parameters:
- buf - buffer to send
- Throws: SQLException
- if an I/O Error returns
ReceiveChar
public int ReceiveChar() throws SQLException
- Receives a single character from the backend
- Returns:
- the character received
- Throws: SQLException
- if an I/O Error returns
ReceiveInteger
public int ReceiveInteger(int siz) throws SQLException
- Receives an integer from the backend
- Parameters:
- siz - length of the integer in bytes
- Returns:
- the integer received from the backend
- Throws: SQLException
- if an I/O error occurs
ReceiveIntegerR
public int ReceiveIntegerR(int siz) throws SQLException
- Receives an integer from the backend
- Parameters:
- siz - length of the integer in bytes
- Returns:
- the integer received from the backend
- Throws: SQLException
- if an I/O error occurs
ReceiveString
public String ReceiveString(int maxsiz) throws SQLException
- Receives a null-terminated string from the backend. Maximum of
maxsiz bytes - if we don't see a null, then we assume something
has gone wrong.
- Parameters:
- maxsiz - maximum length of string
- Returns:
- string from back end
- Throws: SQLException
- if an I/O error occurs
ReceiveTuple
public byte[][] ReceiveTuple(int nf,
boolean bin) throws SQLException
- Read a tuple from the back end. A tuple is a two dimensional
array of bytes
- Parameters:
- nf - the number of fields expected
- bin - true if the tuple is a binary tuple
- Returns:
- null if the current response has no more tuples, otherwise
an array of strings
- Throws: SQLException
- if a data I/O error occurs
Receive
public void Receive(byte b[],
int off,
int siz) throws SQLException
- Reads in a given number of bytes from the backend
- Parameters:
- buf - buffer to store result
- off - offset in buffer
- siz - number of bytes to read
- Throws: SQLException
- if a data I/O error occurs
flush
public void flush() throws SQLException
- This flushes any pending output to the backend. It is used primarily
by the Fastpath code.
- Throws: SQLException
- if an I/O error occurs
close
public void close() throws IOException
- Closes the connection
- Throws: IOException
- if a IO Error occurs
All Packages Class Hierarchy This Package Previous Next Index