Java Doc for ReadStream.java in  » EJB-Server-resin-3.1.5 » util » com » caucho » vfs » 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 » EJB Server resin 3.1.5 » util » com.caucho.vfs 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.io.InputStream
      com.caucho.vfs.ReadStream

ReadStream
final public class ReadStream extends InputStream implements LockableStream(Code)
A fast bufferered input stream supporting both character and byte data. The underlying stream sources are provided by StreamImpl classes, so all streams have the same API regardless of the underlying implementation.

Dynamic streams, like tcp and http will properly flush writes before reading input. And random access streams, like RandomAccessFile, can use the same API as normal streams.

Most applications will use the Path routines to create their own streams. Specialized applications, like servers, need the capability of recycling streams.


Inner Class :public class StreamReader extends Reader

Field Summary
public static  intZERO_COPY_SIZE
    

Constructor Summary
public  ReadStream()
     Creates an uninitialized stream.
public  ReadStream(StreamImpl source)
     Creates a stream and initializes with a specified source.
public  ReadStream(StreamImpl source, WriteStream sibling)
     Creates a stream and initializes with a specified source.

Method Summary
public  intavailable()
     Compatibility with InputStream.
public  booleancanRead()
     Returns true if the stream allows reading.
public  voidclearRead()
     Clears the read buffer.
final public  voidclose()
     Close the stream.
public  intfillBuffer()
     Fills the buffer from the underlying stream.
public  booleanfillWithTimeout(long timeout)
     Fills the buffer with a non-blocking read.
public  ObjectgetAttribute(String name)
     Returns a named attribute.
public  IteratorgetAttributeNames()
     Lists all named attributes.
public  intgetAvailable()
     Returns an estimate of the available bytes.
public  byte[]getBuffer()
    
public  intgetBufferAvailable()
     Returns true if data in the buffer is available.
public  StringgetEncoding()
     Returns the mime-encoding currently read.
public  intgetLength()
    
public  intgetOffset()
    
public  PathgetPath()
     Returns the Path which opened this stream.
public  longgetPosition()
     Returns the read position.
public  longgetReadTime()
     Returns the last read-time.
public  ReadergetReader()
     Returns a Reader reading to this stream.
public  WriteStreamgetSibling()
    
public  StreamImplgetSource()
     Returns the underlying source for the stream.
public  StringgetURL()
     Returns the user path which opened this stream.
public  StringgetUserPath()
     Returns the user path which opened this stream.
public  voidinit(StreamImpl source, WriteStream sibling)
     Initializes the stream with a given source.
public  booleanlock(boolean shared, boolean block)
    
public  voidpushFilter(StreamFilter filter)
     Pushes a filter on the top of the stream stack.
final public  intread()
     Returns the next byte or -1 if at the end of file.
final public  intread(byte[] buf, int offset, int length)
     Reads into a byte array.
final public  intread(char[] buf, int offset, int length)
     Reads into a character buffer from the stream.
public  intread(CharBuffer buf, int length)
     Reads characters from the stream, appending to the character buffer.
public  intreadAll(byte[] buf, int offset, int length)
     Reads into a byte array.
public  intreadAll(char[] buf, int offset, int length)
     Reads into a character buffer from the stream.
public  intreadAll(CharBuffer buf, int length)
     Reads characters from the stream, appending to the character buffer.
final public  intreadChar()
     Reads a character from the stream, returning -1 on end of file.
public  StringreadLine()
     Reads a line, returning a string.
final public  booleanreadLine(CharBuffer cb)
     Reads a line into the character buffer.
final public  booleanreadLine(CharBuffer cb, boolean isChop)
     Reads a line into the character buffer.
final public  intreadLine(char[] buf, int length)
     Reads a line into the character buffer.
final public  intreadLine(char[] buf, int length, boolean isChop)
     Reads a line into the character buffer.
public  StringreadLineNoChop()
     Reads a line, returning a string.
public  booleanreadNonBlock()
     Fills the buffer with a non-blocking read.
final public  Stringreadln()
     Reads a line from the stream, returning a string.
final public  booleanreadln(CharBuffer cb)
     Fills the buffer with the next line from the input stream.
public  voidremoveAttribute(String name)
     Removes a named attribute.
public  voidsetAttribute(String name, Object value)
     Sets a named attribute.
public  voidsetDisableClose(boolean disableClose)
     Disables close.
public  voidsetDisableCloseSource(boolean disableClose)
     Disables closing of the underlying source.
public  voidsetEncoding(String encoding)
     Sets the current read encoding.
public  voidsetOffset(int offset)
    
public  voidsetPath(Path path)
     Sets a path name associated with the stream.
public  booleansetPosition(long pos)
     Returns the sets current read position.
public  voidsetReuseBuffer(boolean reuse)
    
public  voidsetSibling(WriteStream sibling)
    
public  longskip(long n)
     Skips the next n bytes.
Parameters:
  n - bytes to skip.
public  StringtoString()
     Returns a printable representation of the read stream.
public  booleanunlock()
    
final public  voidunread()
     Unreads the last byte.
final public  booleanwaitForRead()
     Waits for data to be available.
public  voidwriteToStream(OutputStream os)
     Copies this stream to the output stream.
public  voidwriteToStream(OutputStream os, int len)
     Writes len bytes to the output stream from this stream.
public  voidwriteToWriter(Writer out)
     Copies this stream to the output stream.

Field Detail
ZERO_COPY_SIZE
public static int ZERO_COPY_SIZE(Code)




Constructor Detail
ReadStream
public ReadStream()(Code)
Creates an uninitialized stream. Use init to initialize.



ReadStream
public ReadStream(StreamImpl source)(Code)
Creates a stream and initializes with a specified source.
Parameters:
  source - Underlying source for the stream.



ReadStream
public ReadStream(StreamImpl source, WriteStream sibling)(Code)
Creates a stream and initializes with a specified source.
Parameters:
  source - Underlying source for the stream.
Parameters:
  sibling - Sibling write stream.




Method Detail
available
public int available() throws IOException(Code)
Compatibility with InputStream.



canRead
public boolean canRead()(Code)
Returns true if the stream allows reading.



clearRead
public void clearRead()(Code)
Clears the read buffer.



close
final public void close()(Code)
Close the stream.



fillBuffer
public int fillBuffer() throws IOException(Code)
Fills the buffer from the underlying stream.



fillWithTimeout
public boolean fillWithTimeout(long timeout) throws IOException(Code)
Fills the buffer with a non-blocking read.



getAttribute
public Object getAttribute(String name) throws IOException(Code)
Returns a named attribute. For example, an HTTP stream may use this to return header values.



getAttributeNames
public Iterator getAttributeNames() throws IOException(Code)
Lists all named attributes.



getAvailable
public int getAvailable() throws IOException(Code)
Returns an estimate of the available bytes. If a read would not block, it will always return greater than 0.



getBuffer
public byte[] getBuffer()(Code)



getBufferAvailable
public int getBufferAvailable() throws IOException(Code)
Returns true if data in the buffer is available.



getEncoding
public String getEncoding()(Code)
Returns the mime-encoding currently read.



getLength
public int getLength()(Code)



getOffset
public int getOffset()(Code)



getPath
public Path getPath()(Code)
Returns the Path which opened this stream.



getPosition
public long getPosition()(Code)
Returns the read position.



getReadTime
public long getReadTime()(Code)
Returns the last read-time.



getReader
public Reader getReader()(Code)
Returns a Reader reading to this stream.



getSibling
public WriteStream getSibling()(Code)



getSource
public StreamImpl getSource()(Code)
Returns the underlying source for the stream. the source



getURL
public String getURL()(Code)
Returns the user path which opened this stream.

Parsing routines typically use this for error reporting.




getUserPath
public String getUserPath()(Code)
Returns the user path which opened this stream.

Parsing routines typically use this for error reporting.




init
public void init(StreamImpl source, WriteStream sibling)(Code)
Initializes the stream with a given source.
Parameters:
  source - Underlying source for the stream.
Parameters:
  sibling - Sibling write stream



lock
public boolean lock(boolean shared, boolean block)(Code)



pushFilter
public void pushFilter(StreamFilter filter)(Code)
Pushes a filter on the top of the stream stack.
Parameters:
  filter - the filter to be added.



read
final public int read() throws IOException(Code)
Returns the next byte or -1 if at the end of file.



read
final public int read(byte[] buf, int offset, int length) throws IOException(Code)
Reads into a byte array. read may return less than the maximum bytes even if more bytes are available to read.
Parameters:
  buf - byte array
Parameters:
  offset - offset into the byte array to start reading
Parameters:
  length - maximum byte allowed to read. number of bytes read or -1 on end of file.



read
final public int read(char[] buf, int offset, int length) throws IOException(Code)
Reads into a character buffer from the stream. Like the byte array version, read may return less characters even though more characters are available.
Parameters:
  buf - character buffer to fill
Parameters:
  offset - starting offset into the character buffer
Parameters:
  length - maximum number of characters to read number of characters read or -1 on end of file.



read
public int read(CharBuffer buf, int length) throws IOException(Code)
Reads characters from the stream, appending to the character buffer.
Parameters:
  buf - character buffer to fill
Parameters:
  length - maximum number of characters to read number of characters read or -1 on end of file.



readAll
public int readAll(byte[] buf, int offset, int length) throws IOException(Code)
Reads into a byte array. readAll will always read length bytes, blocking if necessary, until the end of file is reached.
Parameters:
  buf - byte array
Parameters:
  offset - offset into the byte array to start reading
Parameters:
  length - maximum byte allowed to read. number of bytes read or -1 on end of file.



readAll
public int readAll(char[] buf, int offset, int length) throws IOException(Code)
Reads into a character buffer from the stream. length characters will always be read until the end of file is reached.
Parameters:
  buf - character buffer to fill
Parameters:
  offset - starting offset into the character buffer
Parameters:
  length - maximum number of characters to read number of characters read or -1 on end of file.



readAll
public int readAll(CharBuffer buf, int length) throws IOException(Code)
Reads characters from the stream, appending to the character buffer. length characters will always be read until the end of file.
Parameters:
  buf - character buffer to fill
Parameters:
  length - maximum number of characters to read number of characters read or -1 on end of file.



readChar
final public int readChar() throws IOException(Code)
Reads a character from the stream, returning -1 on end of file.



readLine
public String readLine() throws IOException(Code)
Reads a line, returning a string.



readLine
final public boolean readLine(CharBuffer cb) throws IOException(Code)
Reads a line into the character buffer. \r\n is converted to \n.
Parameters:
  buf - character buffer to fill false on end of file



readLine
final public boolean readLine(CharBuffer cb, boolean isChop) throws IOException(Code)
Reads a line into the character buffer. \r\n is converted to \n.
Parameters:
  buf - character buffer to fill false on end of file



readLine
final public int readLine(char[] buf, int length) throws IOException(Code)
Reads a line into the character buffer. \r\n is converted to \n.
Parameters:
  buf - character buffer to fill.
Parameters:
  length - number of characters to fill. -1 on end of file or the number of characters read.



readLine
final public int readLine(char[] buf, int length, boolean isChop) throws IOException(Code)
Reads a line into the character buffer. \r\n is converted to \n.
Parameters:
  buf - character buffer to fill.
Parameters:
  length - number of characters to fill. -1 on end of file or the number of characters read.



readLineNoChop
public String readLineNoChop() throws IOException(Code)
Reads a line, returning a string.



readNonBlock
public boolean readNonBlock() throws IOException(Code)
Fills the buffer with a non-blocking read.



readln
final public String readln() throws IOException(Code)
Reads a line from the stream, returning a string.



readln
final public boolean readln(CharBuffer cb) throws IOException(Code)
Fills the buffer with the next line from the input stream. true on success, false on end of file.



removeAttribute
public void removeAttribute(String name) throws IOException(Code)
Removes a named attribute.



setAttribute
public void setAttribute(String name, Object value) throws IOException(Code)
Sets a named attribute. For example, an HTTP stream may use this to set header values.



setDisableClose
public void setDisableClose(boolean disableClose)(Code)
Disables close. Sometimes an application will pass a stream to a client that may close the stream at an inappropriate time. Setting disable close gives the calling routine control over closing the stream.



setDisableCloseSource
public void setDisableCloseSource(boolean disableClose)(Code)
Disables closing of the underlying source.



setEncoding
public void setEncoding(String encoding) throws UnsupportedEncodingException(Code)
Sets the current read encoding. The encoding can either be a Java encoding name or a mime encoding.
Parameters:
  encoding - name of the read encoding



setOffset
public void setOffset(int offset)(Code)



setPath
public void setPath(Path path)(Code)
Sets a path name associated with the stream.



setPosition
public boolean setPosition(long pos) throws IOException(Code)
Returns the sets current read position.



setReuseBuffer
public void setReuseBuffer(boolean reuse)(Code)



setSibling
public void setSibling(WriteStream sibling)(Code)



skip
public long skip(long n) throws IOException(Code)
Skips the next n bytes.
Parameters:
  n - bytes to skip. number of bytes skipped.



toString
public String toString()(Code)
Returns a printable representation of the read stream.



unlock
public boolean unlock()(Code)



unread
final public void unread()(Code)
Unreads the last byte.



waitForRead
final public boolean waitForRead() throws IOException(Code)
Waits for data to be available.



writeToStream
public void writeToStream(OutputStream os) throws IOException(Code)
Copies this stream to the output stream.
Parameters:
  os - destination stream.



writeToStream
public void writeToStream(OutputStream os, int len) throws IOException(Code)
Writes len bytes to the output stream from this stream.
Parameters:
  os - destination stream.
Parameters:
  len - bytes to write.



writeToWriter
public void writeToWriter(Writer out) throws IOException(Code)
Copies this stream to the output stream.
Parameters:
  out - destination writer



Methods inherited from java.io.InputStream
public int available() throws IOException(Code)(Java Doc)
public void close() throws IOException(Code)(Java Doc)
public synchronized void mark(int readlimit)(Code)(Java Doc)
public boolean markSupported()(Code)(Java Doc)
abstract public int read() throws IOException(Code)(Java Doc)
public int read(byte b) throws IOException(Code)(Java Doc)
public int read(byte b, int off, int len) throws IOException(Code)(Java Doc)
public synchronized void reset() throws IOException(Code)(Java Doc)
public long skip(long n) throws IOException(Code)(Java Doc)

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.