Java Doc for BufferedConnectionAdapter.java in  » 6.0-JDK-Modules » j2me » com » sun » cdc » io » 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 » 6.0 JDK Modules » j2me » com.sun.cdc.io 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.cdc.io.ConnectionBaseAdapter
      com.sun.cdc.io.BufferedConnectionAdapter

All known Subclasses:   com.sun.cdc.io.j2me.comm.Protocol,
BufferedConnectionAdapter
abstract public class BufferedConnectionAdapter extends ConnectionBaseAdapter (Code)
This class adds read buffering to the ConnectionBaseAdapter.

Implements InputStream.available , however a subclass must specify a buffer size greater than 0 and override BufferedConnectionAdapter.readBytesNonBlocking(byte[],int,int) in order to for available to work properly.



Field Summary
protected  bytebuf
     The internal buffer array where the data is stored.
protected  intcount
     The index one greater than the index of the last valid byte in the buffer.
protected  booleaneof
     The end of file flag.
protected  intpos
     The current position in the buffer.

Constructor Summary
protected  BufferedConnectionAdapter(int sizeOfBuffer)
     Initializes the connection.

Method Summary
public  intavailable()
     Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream.
abstract protected  intnonBufferedRead(byte b, int off, int len)
     Reads up to len bytes of data from the input stream into an array of bytes, blocks until at least one byte is available. Sets the eof field of the connection when there is no more data in the stream to read.
Parameters:
  b - the buffer into which the data is read.
Parameters:
  off - the start offset in array bat which the data is written.
Parameters:
  len - the maximum number of bytes to read.
public  intreadBytes(byte b, int off, int len)
     Reads up to len bytes of data from the input stream into an array of bytes, blocks until at least one byte is available.

Do not use this method if openInputStream has been called since the input stream may be buffering data.
Parameters:
  b - the buffer into which the data is read.
Parameters:
  off - the start offset in array bat which the data is written.
Parameters:
  len - the maximum number of bytes to read.

protected  intreadBytesNonBlocking(byte b, int off, int len)
     Reads up to len bytes of data from the input stream into an array of bytes, but does not block if no bytes available.

Field Detail
buf
protected byte buf(Code)
The internal buffer array where the data is stored. When necessary, it may be replaced by another array of a different size.



count
protected int count(Code)
The index one greater than the index of the last valid byte in the buffer. This value is always in the range 0 through buf.length; elements buf[0] through buf[count-1] contain buffered input data obtained from the underlying input stream.



eof
protected boolean eof(Code)
The end of file flag.



pos
protected int pos(Code)
The current position in the buffer. This is the index of the next character to be read from the buf array.

This value is always in the range 0 through count. If it is less than count, then buf[pos] is the next byte to be supplied as input; if it is equal to count, then the next read or skip operation will require more bytes to be read from the contained input stream.





Constructor Detail
BufferedConnectionAdapter
protected BufferedConnectionAdapter(int sizeOfBuffer)(Code)
Initializes the connection.
Parameters:
  sizeOfBuffer - size of the internal buffer or 0 for no buffer




Method Detail
available
public int available() throws IOException(Code)
Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream. The next caller might be the same thread or another thread.

The available method always returns 0 if BufferedConnectionAdapter.readBytesNonBlocking(byte[],int,int) is not overridden by the subclass or there is not buffer. the number of bytes that can be read from this input streamwithout blocking.
exception:
  IOException - if an I/O error occurs.




nonBufferedRead
abstract protected int nonBufferedRead(byte b, int off, int len) throws IOException(Code)
Reads up to len bytes of data from the input stream into an array of bytes, blocks until at least one byte is available. Sets the eof field of the connection when there is no more data in the stream to read.
Parameters:
  b - the buffer into which the data is read.
Parameters:
  off - the start offset in array bat which the data is written.
Parameters:
  len - the maximum number of bytes to read. the total number of bytes read into the buffer, or-1 if there is no more data because the end ofthe stream has been reached.
exception:
  IOException - if an I/O error occurs.



readBytes
public int readBytes(byte b, int off, int len) throws IOException(Code)
Reads up to len bytes of data from the input stream into an array of bytes, blocks until at least one byte is available.

Do not use this method if openInputStream has been called since the input stream may be buffering data.
Parameters:
  b - the buffer into which the data is read.
Parameters:
  off - the start offset in array bat which the data is written.
Parameters:
  len - the maximum number of bytes to read. the total number of bytes read into the buffer, or-1 if there is no more data because the end ofthe stream has been reached.
exception:
  IOException - if an I/O error occurs.




readBytesNonBlocking
protected int readBytesNonBlocking(byte b, int off, int len) throws IOException(Code)
Reads up to len bytes of data from the input stream into an array of bytes, but does not block if no bytes available. A subclass should implement this to so the available method on the InputStream will be useful. Sets the eof field of the connection when the native read returns -1.

The readBytesNonBlocking method of ConnectionBaseAdapter does nothing and returns 0.
Parameters:
  b - the buffer into which the data is read.
Parameters:
  off - the start offset in array bat which the data is written.
Parameters:
  len - the maximum number of bytes to read. the total number of bytes read into the buffer, or-1 if there is no more data because the end ofthe stream has been reached.
exception:
  IOException - if an I/O error occurs.




Fields inherited from com.sun.cdc.io.ConnectionBaseAdapter
protected boolean connectionOpen(Code)(Java Doc)
protected static int iStreams(Code)(Java Doc)
protected int maxIStreams(Code)(Java Doc)
protected int maxOStreams(Code)(Java Doc)
protected static int oStreams(Code)(Java Doc)

Methods inherited from com.sun.cdc.io.ConnectionBaseAdapter
public int available() throws IOException(Code)(Java Doc)
protected void checkForPermission() throws SecurityException, InterruptedIOException(Code)(Java Doc)
public void close() throws IOException(Code)(Java Doc)
void closeCommon() throws IOException(Code)(Java Doc)
protected void closeInputStream() throws IOException(Code)(Java Doc)
protected void closeOutputStream() throws IOException(Code)(Java Doc)
abstract protected void connect(String name, int mode, boolean timeouts) throws IOException(Code)(Java Doc)
abstract protected void disconnect() throws IOException(Code)(Java Doc)
protected void ensureNoStreamsOpen() throws IOException(Code)(Java Doc)
protected void ensureOpen() throws IOException(Code)(Java Doc)
protected void flush() throws IOException(Code)(Java Doc)
public synchronized void mark(int readlimit)(Code)(Java Doc)
public boolean markSupported()(Code)(Java Doc)
public DataInputStream openDataInputStream() throws IOException(Code)(Java Doc)
public DataOutputStream openDataOutputStream() throws IOException(Code)(Java Doc)
public InputStream openInputStream() throws IOException(Code)(Java Doc)
public OutputStream openOutputStream() throws IOException(Code)(Java Doc)
public Connection openPrim(String name, int mode, boolean timeouts) throws IOException(Code)(Java Doc)
public Connection openPrim(String name) throws IOException(Code)(Java Doc)
abstract protected int readBytes(byte b, int off, int len) throws IOException(Code)(Java Doc)
public synchronized void reset() throws IOException(Code)(Java Doc)
abstract protected int writeBytes(byte b, int off, int len) throws IOException(Code)(Java Doc)

Methods inherited from java.lang.Object
public boolean equals(Object obj)(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.