Java Doc for PGStream.java in  » Database-JDBC-Connection-Pool » postgresql » org » postgresql » core » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database JDBC Connection Pool » postgresql » org.postgresql.core 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.postgresql.core.PGStream

PGStream
public class PGStream (Code)
Wrapper around the raw connection to the server that implements some basic primitives (reading/writing formatted data, doing string encoding, etc).

In general, instances of PGStream are not threadsafe; the caller must ensure that only one thread at a time is accessing a particular PGStream instance.




Constructor Summary
public  PGStream(String host, int port)
     Constructor: Connect to the PostgreSQL back end and return a stream connection.

Method Summary
public  byte[]Receive(int siz)
    
public  voidReceive(byte[] buf, int off, int siz)
    
public  intReceiveChar()
    
public  voidReceiveEOF()
    
public  intReceiveInteger2()
    
public  intReceiveInteger4()
    
public  StringReceiveString(int len)
     Receives a fixed-size string from the backend.
Parameters:
  len - the length of the string to receive, in bytes.
public  StringReceiveString()
     Receives a null-terminated string from the backend.
public  byte[][]ReceiveTupleV2(int nf, boolean bin)
     Read a tuple from the back end.
public  byte[][]ReceiveTupleV3()
     Read a tuple from the back end.
public  voidSend(byte buf)
    
public  voidSend(byte buf, int siz)
     Send a fixed-size array of bytes to the backend.
public  voidSend(byte buf, int off, int siz)
     Send a fixed-size array of bytes to the backend.
public  voidSendChar(int val)
    
public  voidSendInteger2(int val)
    
public  voidSendInteger4(int val)
    
public  voidSendStream(InputStream inStream, int remaining)
     Copy data from an input stream to the connection.
public  voidSkip(int size)
    
public  voidchangeSocket(Socket socket)
     Switch this stream to using a new socket.
public  voidclose()
    
public  voidflush()
     Flush any pending output to the backend.
public  EncodinggetEncoding()
    
public  WritergetEncodingWriter()
     Get a Writer instance that encodes directly onto the underlying stream.
public  StringgetHost()
    
public  intgetPort()
    
public  SocketgetSocket()
    
public  booleanhasMessagePending()
     Check for pending backend messages without blocking. Might return false when there actually are messages waiting, depending on the characteristics of the underlying socket.
public  voidsetEncoding(Encoding encoding)
     Change the encoding used by this connection.


Constructor Detail
PGStream
public PGStream(String host, int port) throws IOException(Code)
Constructor: Connect to the PostgreSQL back end and return a stream connection.
Parameters:
  host - the hostname to connect to
Parameters:
  port - the port number that the postmaster is sitting on
exception:
  IOException - if an IOException occurs below it.




Method Detail
Receive
public byte[] Receive(int siz) throws IOException(Code)
Reads in a given number of bytes from the backend
Parameters:
  siz - number of bytes to read array of bytes received
exception:
  IOException - if a data I/O error occurs



Receive
public void Receive(byte[] buf, int off, int siz) throws IOException(Code)
Reads in a given number of bytes from the backend
Parameters:
  buf - buffer to store result
Parameters:
  off - offset in buffer
Parameters:
  siz - number of bytes to read
exception:
  IOException - if a data I/O error occurs



ReceiveChar
public int ReceiveChar() throws IOException(Code)
Receives a single character from the backend the character received
exception:
  IOException - if an I/O Error occurs



ReceiveEOF
public void ReceiveEOF() throws SQLException, IOException(Code)
Consume an expected EOF from the backend
exception:
  SQLException - if we get something other than an EOF



ReceiveInteger2
public int ReceiveInteger2() throws IOException(Code)
Receives a two byte integer from the backend the integer received from the backend
exception:
  IOException - if an I/O error occurs



ReceiveInteger4
public int ReceiveInteger4() throws IOException(Code)
Receives a four byte integer from the backend the integer received from the backend
exception:
  IOException - if an I/O error occurs



ReceiveString
public String ReceiveString(int len) throws IOException(Code)
Receives a fixed-size string from the backend.
Parameters:
  len - the length of the string to receive, in bytes. the decoded string



ReceiveString
public String ReceiveString() throws IOException(Code)
Receives a null-terminated string from the backend. If we don't see a null, then we assume something has gone wrong. string from back end
exception:
  IOException - if an I/O error occurs, or end of file



ReceiveTupleV2
public byte[][] ReceiveTupleV2(int nf, boolean bin) throws IOException, OutOfMemoryError(Code)
Read a tuple from the back end. A tuple is a two dimensional array of bytes. This variant reads the V2 protocol's tuple representation.
Parameters:
  nf - the number of fields expected
Parameters:
  bin - true if the tuple is a binary tuple null if the current response has no more tuples, otherwisean array of bytearrays
exception:
  IOException - if a data I/O error occurs



ReceiveTupleV3
public byte[][] ReceiveTupleV3() throws IOException, OutOfMemoryError(Code)
Read a tuple from the back end. A tuple is a two dimensional array of bytes. This variant reads the V3 protocol's tuple representation. null if the current response has no more tuples, otherwisean array of bytearrays
exception:
  IOException - if a data I/O error occurs



Send
public void Send(byte buf) throws IOException(Code)
Send an array of bytes to the backend
Parameters:
  buf - The array of bytes to be sent
exception:
  IOException - if an I/O error occurs



Send
public void Send(byte buf, int siz) throws IOException(Code)
Send a fixed-size array of bytes to the backend. If buf.length < siz, pad with zeros. If buf.lengh > siz, truncate the array.
Parameters:
  buf - the array of bytes to be sent
Parameters:
  siz - the number of bytes to be sent
exception:
  IOException - if an I/O error occurs



Send
public void Send(byte buf, int off, int siz) throws IOException(Code)
Send a fixed-size array of bytes to the backend. If length < siz, pad with zeros. If length > siz, truncate the array.
Parameters:
  buf - the array of bytes to be sent
Parameters:
  off - offset in the array to start sending from
Parameters:
  siz - the number of bytes to be sent
exception:
  IOException - if an I/O error occurs



SendChar
public void SendChar(int val) throws IOException(Code)
Sends a single character to the back end
Parameters:
  val - the character to be sent
exception:
  IOException - if an I/O error occurs



SendInteger2
public void SendInteger2(int val) throws IOException(Code)
Sends a 2-byte integer (short) to the back end
Parameters:
  val - the integer to be sent
exception:
  IOException - if an I/O error occurs or val cannot be encoded in 2 bytes



SendInteger4
public void SendInteger4(int val) throws IOException(Code)
Sends a 4-byte integer to the back end
Parameters:
  val - the integer to be sent
exception:
  IOException - if an I/O error occurs



SendStream
public void SendStream(InputStream inStream, int remaining) throws IOException(Code)
Copy data from an input stream to the connection.
Parameters:
  inStream - the stream to read data from
Parameters:
  remaining - the number of bytes to copy



Skip
public void Skip(int size) throws IOException(Code)



changeSocket
public void changeSocket(Socket socket) throws IOException(Code)
Switch this stream to using a new socket. Any existing socket is not closed; it's assumed that we are changing to a new socket that delegates to the original socket (e.g. SSL).
Parameters:
  socket - the new socket to change to
throws:
  IOException - if something goes wrong



close
public void close() throws IOException(Code)
Closes the connection
exception:
  IOException - if an I/O Error occurs



flush
public void flush() throws IOException(Code)
Flush any pending output to the backend.
exception:
  IOException - if an I/O error occurs



getEncoding
public Encoding getEncoding()(Code)



getEncodingWriter
public Writer getEncodingWriter() throws IOException(Code)
Get a Writer instance that encodes directly onto the underlying stream.

The returned Writer should not be closed, as it's a shared object. Writer.flush needs to be called when switching between use of the Writer and use of the PGStream write methods, but it won't actually flush output all the way out -- call PGStream.flush to actually ensure all output has been pushed to the server. the shared Writer instance
throws:
  IOException - if something goes wrong.




getHost
public String getHost()(Code)



getPort
public int getPort()(Code)



getSocket
public Socket getSocket()(Code)



hasMessagePending
public boolean hasMessagePending() throws IOException(Code)
Check for pending backend messages without blocking. Might return false when there actually are messages waiting, depending on the characteristics of the underlying socket. This is used to detect asynchronous notifies from the backend, when available. true if there is a pending backend message



setEncoding
public void setEncoding(Encoding encoding) throws IOException(Code)
Change the encoding used by this connection.
Parameters:
  encoding - the new encoding to use
throws:
  IOException - if something goes wrong



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.