Java Doc for BlockingConnection.java in  » Web-Server » xsocket » org » xsocket » connection » 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 » Web Server » xsocket » org.xsocket.connection 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.xsocket.connection.BlockingConnection

BlockingConnection
public class BlockingConnection implements IBlockingConnection(Code)
Implementation of the IBlockingConnection interface. Internally a INonBlockingConnection will be used. A BlockingConnection wraps a INonBlockingConnection. There are two ways to create a BlockingConnection:
  • by passing over the remote address (e.g. host name & port), or
  • by passing over a INonBlockingConnection, which will be wrapped


A newly created connection is in the open state. Write or read methods can be called immediately

The methods of this class are not thread-safe.
author:
   grro@xsocket.org



Constructor Summary
public  BlockingConnection(String hostname, int port)
     constructor.
public  BlockingConnection(String hostname, int port, Map<String, Object> options)
     constructor.
public  BlockingConnection(InetAddress address, int port)
    
public  BlockingConnection(InetAddress address, int port, int connectTimeoutMillis)
    
public  BlockingConnection(InetAddress address, int port, SSLContext sslContext, boolean sslOn)
     constructor
Parameters:
  address - the remote host name
Parameters:
  port - the remote host port
Parameters:
  sslContext - the sslContext to use
Parameters:
  sslOn - true, activate SSL mode.
public  BlockingConnection(InetAddress address, int port, int connectTimeoutMillis, SSLContext sslContext, boolean sslOn)
     constructor
Parameters:
  address - the remote host name
Parameters:
  port - the remote host port
Parameters:
  connectTimeoutMillis - the timeout of the connect procedure
Parameters:
  sslContext - the sslContext to use
Parameters:
  sslOn - true, activate SSL mode.
public  BlockingConnection(InetAddress address, int port, Map<String, Object> options, SSLContext sslContext, boolean sslOn)
     constructor
Parameters:
  address - the remote host name
Parameters:
  port - the remote host port
Parameters:
  options - the socket options
Parameters:
  sslContext - the sslContext to use
Parameters:
  sslOn - true, activate SSL mode.
public  BlockingConnection(InetAddress address, int port, int connectTimeoutMillis, Map<String, Object> options, SSLContext sslContext, boolean sslOn)
     constructor
Parameters:
  address - the remote host name
Parameters:
  port - the remote host port
Parameters:
  connectTimeoutMillis - the timeout of the connect procedure
Parameters:
  options - the socket options
Parameters:
  sslContext - the sslContext to use
Parameters:
  sslOn - true, activate SSL mode.
public  BlockingConnection(String hostname, int port, SSLContext sslContext, boolean sslOn)
     constructor
Parameters:
  hostname - the remote host name
Parameters:
  port - the remote host port
Parameters:
  sslContext - the sslContext to use
Parameters:
  sslOn - true, activate SSL mode.
public  BlockingConnection(INonBlockingConnection delegee)
    

Method Summary
final public  voidactivateSecuredMode()
    
final public  voidclose()
    
final public  voidflush()
    
final public  ObjectgetAttachment()
    
final public  longgetConnectionTimeoutMillis()
    
final  INonBlockingConnectiongetDelegee()
    
final public  StringgetEncoding()
    
public  FlushModegetFlushmode()
    
public  StringgetId()
    
final public  longgetIdleTimeoutMillis()
    
final public  InetAddressgetLocalAddress()
    
final public  intgetLocalPort()
    
final public  ObjectgetOption(String name)
    
final public  Map<String, Class>getOptions()
    
final public  intgetPendingWriteDataSize()
    
final public  intgetReceiveTimeoutMillis()
    
public  longgetRemainingMillisToConnectionTimeout()
    
public  longgetRemainingMillisToIdleTimeout()
    
final public  InetAddressgetRemoteAddress()
    
final public  intgetRemotePort()
    
final public  booleanisAutoflush()
    
final public  booleanisOpen()
     return if the data source is open.
public  booleanisSecure()
    
final public  voidmarkReadPosition()
    
final public  voidmarkWritePosition()
    
final public  intread(ByteBuffer buffer)
     .
final public  bytereadByte()
    
final public  ByteBuffer[]readByteBufferByDelimiter(String delimiter)
    
final public  ByteBuffer[]readByteBufferByDelimiter(String delimiter, int maxLength)
    
final public  ByteBuffer[]readByteBufferByDelimiter(String delimiter, String encoding)
    
final public  ByteBuffer[]readByteBufferByDelimiter(String delimiter, String encoding, int maxLength)
    
final public  ByteBuffer[]readByteBufferByLength(int length)
    
final public  byte[]readBytesByDelimiter(String delimiter)
    
final public  byte[]readBytesByDelimiter(String delimiter, int maxLength)
    
final public  byte[]readBytesByDelimiter(String delimiter, String encoding)
    
final public  byte[]readBytesByDelimiter(String delimiter, String encoding, int maxLength)
    
final public  byte[]readBytesByLength(int length)
    
final public  doublereadDouble()
    
final public  intreadInt()
    
final public  longreadLong()
    
final public  shortreadShort()
    
final public  StringreadStringByDelimiter(String delimiter)
    
final public  StringreadStringByDelimiter(String delimiter, int maxLength)
    
final public  StringreadStringByDelimiter(String delimiter, String encoding)
    
final public  StringreadStringByDelimiter(String delimiter, String encoding, int maxLength)
    
final public  StringreadStringByLength(int length)
    
final public  StringreadStringByLength(int length, String encoding)
    
final public  voidremoveReadMark()
    
final public  voidremoveWriteMark()
    
final public  booleanresetToReadMark()
    
final public  booleanresetToWriteMark()
    
final public  voidresumeRead()
    
final public  voidsetAttachment(Object obj)
    
final public  voidsetAutoflush(boolean autoflush)
    
final public  voidsetConnectionTimeoutMillis(long timeoutMillis)
    
final public  voidsetEncoding(String defaultEncoding)
    
public  voidsetFlushmode(FlushMode flushMode)
    
final public  voidsetIdleTimeoutMillis(long timeoutInMillis)
    
final public  voidsetOption(String name, Object value)
    
public  voidsetReceiveTimeoutMillis(int timeout)
    
final public  voidsuspendRead()
    
public  StringtoString()
    
final public  longtransferFrom(ReadableByteChannel source)
    
final public  longtransferFrom(ReadableByteChannel source, int chunkSize)
    
public  longtransferFrom(FileChannel source)
    
final public  longtransferTo(WritableByteChannel target, int length)
    
final public  intwrite(byte b)
    
final public  intwrite(byte... bytes)
    
final public  intwrite(byte[] bytes, int offset, int length)
    
final public  intwrite(short s)
    
final public  intwrite(int i)
    
final public  intwrite(long l)
    
final public  intwrite(double d)
    
final public  intwrite(String message)
    
final public  intwrite(String message, String encoding)
    
final public  longwrite(ArrayList<ByteBuffer> buffers)
    
final public  longwrite(List<ByteBuffer> buffers)
    
final public  longwrite(ByteBuffer[] buffers)
    
public  longwrite(ByteBuffer[] srcs, int offset, int length)
    
final public  intwrite(ByteBuffer buffer)
    


Constructor Detail
BlockingConnection
public BlockingConnection(String hostname, int port) throws IOException(Code)
constructor.


Parameters:
  hostname - the remote host
Parameters:
  port - the port of the remote host to connect
throws:
  IOException - If some other I/O error occurs



BlockingConnection
public BlockingConnection(String hostname, int port, Map<String, Object> options) throws IOException(Code)
constructor.


Parameters:
  hostname - the remote host
Parameters:
  port - the port of the remote host to connect
Parameters:
  options - the socket options
throws:
  IOException - If some other I/O error occurs



BlockingConnection
public BlockingConnection(InetAddress address, int port) throws IOException(Code)
constructor
Parameters:
  address - the remote host address
Parameters:
  port - the remote host port
throws:
  IOException - If some other I/O error occurs



BlockingConnection
public BlockingConnection(InetAddress address, int port, int connectTimeoutMillis) throws IOException(Code)
constructor
Parameters:
  address - the remote host address
Parameters:
  port - the remote host port
Parameters:
  connectTimeoutMillis - the timeout of the connect procedure
throws:
  IOException - If some other I/O error occurs



BlockingConnection
public BlockingConnection(InetAddress address, int port, SSLContext sslContext, boolean sslOn) throws IOException(Code)
constructor
Parameters:
  address - the remote host name
Parameters:
  port - the remote host port
Parameters:
  sslContext - the sslContext to use
Parameters:
  sslOn - true, activate SSL mode. false, ssl can be activated by user (see IReadWriteableConnection.activateSecuredMode)
throws:
  IOException - If some other I/O error occurs



BlockingConnection
public BlockingConnection(InetAddress address, int port, int connectTimeoutMillis, SSLContext sslContext, boolean sslOn) throws IOException(Code)
constructor
Parameters:
  address - the remote host name
Parameters:
  port - the remote host port
Parameters:
  connectTimeoutMillis - the timeout of the connect procedure
Parameters:
  sslContext - the sslContext to use
Parameters:
  sslOn - true, activate SSL mode. false, ssl can be activated by user (see IReadWriteableConnection.activateSecuredMode)
throws:
  IOException - If some other I/O error occurs



BlockingConnection
public BlockingConnection(InetAddress address, int port, Map<String, Object> options, SSLContext sslContext, boolean sslOn) throws IOException(Code)
constructor
Parameters:
  address - the remote host name
Parameters:
  port - the remote host port
Parameters:
  options - the socket options
Parameters:
  sslContext - the sslContext to use
Parameters:
  sslOn - true, activate SSL mode. false, ssl can be activated by user (see IReadWriteableConnection.activateSecuredMode)
throws:
  IOException - If some other I/O error occurs



BlockingConnection
public BlockingConnection(InetAddress address, int port, int connectTimeoutMillis, Map<String, Object> options, SSLContext sslContext, boolean sslOn) throws IOException(Code)
constructor
Parameters:
  address - the remote host name
Parameters:
  port - the remote host port
Parameters:
  connectTimeoutMillis - the timeout of the connect procedure
Parameters:
  options - the socket options
Parameters:
  sslContext - the sslContext to use
Parameters:
  sslOn - true, activate SSL mode. false, ssl can be activated by user (see IReadWriteableConnection.activateSecuredMode)
throws:
  IOException - If some other I/O error occurs



BlockingConnection
public BlockingConnection(String hostname, int port, SSLContext sslContext, boolean sslOn) throws IOException(Code)
constructor
Parameters:
  hostname - the remote host name
Parameters:
  port - the remote host port
Parameters:
  sslContext - the sslContext to use
Parameters:
  sslOn - true, activate SSL mode. false, ssl can be activated by user (see IReadWriteableConnection.activateSecuredMode)
throws:
  IOException - If some other I/O error occurs



BlockingConnection
public BlockingConnection(INonBlockingConnection delegee) throws IOException(Code)
constructor
Parameters:
  delegee - the underlying non blocking connection
throws:
  IOException - If some other I/O error occurs




Method Detail
activateSecuredMode
final public void activateSecuredMode() throws IOException(Code)



close
final public void close() throws IOException(Code)



flush
final public void flush() throws ClosedChannelException, IOException, SocketTimeoutException(Code)



getAttachment
final public Object getAttachment()(Code)



getConnectionTimeoutMillis
final public long getConnectionTimeoutMillis()(Code)



getDelegee
final INonBlockingConnection getDelegee()(Code)



getEncoding
final public String getEncoding()(Code)



getFlushmode
public FlushMode getFlushmode()(Code)



getId
public String getId()(Code)



getIdleTimeoutMillis
final public long getIdleTimeoutMillis()(Code)



getLocalAddress
final public InetAddress getLocalAddress()(Code)



getLocalPort
final public int getLocalPort()(Code)



getOption
final public Object getOption(String name) throws IOException(Code)



getOptions
final public Map<String, Class> getOptions()(Code)



getPendingWriteDataSize
final public int getPendingWriteDataSize()(Code)



getReceiveTimeoutMillis
final public int getReceiveTimeoutMillis() throws IOException(Code)



getRemainingMillisToConnectionTimeout
public long getRemainingMillisToConnectionTimeout()(Code)



getRemainingMillisToIdleTimeout
public long getRemainingMillisToIdleTimeout()(Code)



getRemoteAddress
final public InetAddress getRemoteAddress()(Code)



getRemotePort
final public int getRemotePort()(Code)



isAutoflush
final public boolean isAutoflush()(Code)



isOpen
final public boolean isOpen()(Code)
return if the data source is open. Default is true true, if the data source is open



isSecure
public boolean isSecure()(Code)



markReadPosition
final public void markReadPosition()(Code)



markWritePosition
final public void markWritePosition()(Code)



read
final public int read(ByteBuffer buffer) throws IOException, ClosedChannelException(Code)
.



readByte
final public byte readByte() throws IOException, SocketTimeoutException(Code)



readByteBufferByDelimiter
final public ByteBuffer[] readByteBufferByDelimiter(String delimiter) throws IOException, SocketTimeoutException(Code)



readByteBufferByDelimiter
final public ByteBuffer[] readByteBufferByDelimiter(String delimiter, int maxLength) throws IOException, MaxReadSizeExceededException, SocketTimeoutException(Code)



readByteBufferByDelimiter
final public ByteBuffer[] readByteBufferByDelimiter(String delimiter, String encoding) throws IOException, SocketTimeoutException(Code)



readByteBufferByDelimiter
final public ByteBuffer[] readByteBufferByDelimiter(String delimiter, String encoding, int maxLength) throws IOException, MaxReadSizeExceededException, SocketTimeoutException(Code)



readByteBufferByLength
final public ByteBuffer[] readByteBufferByLength(int length) throws IOException, SocketTimeoutException(Code)



readBytesByDelimiter
final public byte[] readBytesByDelimiter(String delimiter) throws IOException, SocketTimeoutException(Code)



readBytesByDelimiter
final public byte[] readBytesByDelimiter(String delimiter, int maxLength) throws IOException, MaxReadSizeExceededException, SocketTimeoutException(Code)



readBytesByDelimiter
final public byte[] readBytesByDelimiter(String delimiter, String encoding) throws IOException, SocketTimeoutException(Code)



readBytesByDelimiter
final public byte[] readBytesByDelimiter(String delimiter, String encoding, int maxLength) throws IOException, MaxReadSizeExceededException, SocketTimeoutException(Code)



readBytesByLength
final public byte[] readBytesByLength(int length) throws IOException, SocketTimeoutException(Code)



readDouble
final public double readDouble() throws IOException, SocketTimeoutException(Code)



readInt
final public int readInt() throws IOException, SocketTimeoutException(Code)



readLong
final public long readLong() throws IOException, SocketTimeoutException(Code)



readShort
final public short readShort() throws IOException, SocketTimeoutException(Code)



readStringByDelimiter
final public String readStringByDelimiter(String delimiter) throws IOException, UnsupportedEncodingException, SocketTimeoutException(Code)



readStringByDelimiter
final public String readStringByDelimiter(String delimiter, int maxLength) throws IOException, UnsupportedEncodingException, MaxReadSizeExceededException, SocketTimeoutException(Code)



readStringByDelimiter
final public String readStringByDelimiter(String delimiter, String encoding) throws IOException, UnsupportedEncodingException, MaxReadSizeExceededException, SocketTimeoutException(Code)



readStringByDelimiter
final public String readStringByDelimiter(String delimiter, String encoding, int maxLength) throws IOException, UnsupportedEncodingException, MaxReadSizeExceededException, SocketTimeoutException(Code)



readStringByLength
final public String readStringByLength(int length) throws IOException, UnsupportedEncodingException, SocketTimeoutException(Code)



readStringByLength
final public String readStringByLength(int length, String encoding) throws IOException, UnsupportedEncodingException, SocketTimeoutException(Code)



removeReadMark
final public void removeReadMark()(Code)



removeWriteMark
final public void removeWriteMark()(Code)



resetToReadMark
final public boolean resetToReadMark()(Code)



resetToWriteMark
final public boolean resetToWriteMark()(Code)



resumeRead
final public void resumeRead() throws IOException(Code)



setAttachment
final public void setAttachment(Object obj)(Code)



setAutoflush
final public void setAutoflush(boolean autoflush)(Code)



setConnectionTimeoutMillis
final public void setConnectionTimeoutMillis(long timeoutMillis)(Code)



setEncoding
final public void setEncoding(String defaultEncoding)(Code)



setFlushmode
public void setFlushmode(FlushMode flushMode)(Code)



setIdleTimeoutMillis
final public void setIdleTimeoutMillis(long timeoutInMillis)(Code)



setOption
final public void setOption(String name, Object value) throws IOException(Code)



setReceiveTimeoutMillis
public void setReceiveTimeoutMillis(int timeout) throws IOException(Code)



suspendRead
final public void suspendRead() throws IOException(Code)



toString
public String toString()(Code)



transferFrom
final public long transferFrom(ReadableByteChannel source) throws IOException(Code)



transferFrom
final public long transferFrom(ReadableByteChannel source, int chunkSize) throws IOException(Code)



transferFrom
public long transferFrom(FileChannel source) throws IOException(Code)



transferTo
final public long transferTo(WritableByteChannel target, int length) throws IOException, SocketTimeoutException(Code)



write
final public int write(byte b) throws IOException, BufferOverflowException(Code)



write
final public int write(byte... bytes) throws IOException(Code)



write
final public int write(byte[] bytes, int offset, int length) throws IOException(Code)



write
final public int write(short s) throws IOException(Code)



write
final public int write(int i) throws IOException(Code)



write
final public int write(long l) throws IOException(Code)



write
final public int write(double d) throws IOException(Code)



write
final public int write(String message) throws IOException(Code)



write
final public int write(String message, String encoding) throws IOException(Code)



write
final public long write(ArrayList<ByteBuffer> buffers) throws IOException(Code)



write
final public long write(List<ByteBuffer> buffers) throws IOException(Code)



write
final public long write(ByteBuffer[] buffers) throws IOException(Code)



write
public long write(ByteBuffer[] srcs, int offset, int length) throws IOException(Code)



write
final public int write(ByteBuffer buffer) throws IOException(Code)



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.