Java Doc for PipedInputStream.java in  » Apache-Harmony-Java-SE » java-package » java » 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 » Apache Harmony Java SE » java package » java.io 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.io.InputStream
      java.io.PipedInputStream

PipedInputStream
public class PipedInputStream extends InputStream (Code)
PipedInputStream is a class which receives information on a communications pipe. When two threads want to pass data back and forth, one creates a piped output stream and the other creates a piped input stream.
See Also:   PipedOutputStream


Field Summary
final protected static  intPIPE_SIZE
    
protected  bytebuffer
     The circular buffer through which data is passed.
protected  intin
     The index in buffer where the next byte will be written.
 booleanisConnected
    
protected  intout
     The index in buffer where the next byte will be read.

Constructor Summary
public  PipedInputStream()
     Constructs a new unconnected PipedInputStream.
public  PipedInputStream(PipedOutputStream out)
     Constructs a new PipedInputStream connected to the PipedOutputStream out.

Method Summary
public synchronized  intavailable()
     Answers a int representing the number of bytes that are available before this PipedInputStream will block.
public  voidclose()
     Close this PipedInputStream.
public  voidconnect(PipedOutputStream src)
     Connects this PipedInputStream to a PipedOutputStream.
synchronized  voiddone()
    
public synchronized  intread()
     Reads a single byte from this PipedInputStream and returns the result as an int.
public synchronized  intread(byte[] bytes, int offset, int count)
     Reads at most count bytes from this PipedInputStream and stores them in byte array buffer starting at offset.
protected synchronized  voidreceive(int oneByte)
     Receives a byte and stores it into the PipedInputStream.

Field Detail
PIPE_SIZE
final protected static int PIPE_SIZE(Code)
The size of the default pipe in bytes



buffer
protected byte buffer(Code)
The circular buffer through which data is passed.



in
protected int in(Code)
The index in buffer where the next byte will be written.



isConnected
boolean isConnected(Code)
Indicates if this pipe is connected



out
protected int out(Code)
The index in buffer where the next byte will be read.




Constructor Detail
PipedInputStream
public PipedInputStream()(Code)
Constructs a new unconnected PipedInputStream. The resulting Stream must be connected to a PipedOutputStream before data may be read from it.



PipedInputStream
public PipedInputStream(PipedOutputStream out) throws IOException(Code)
Constructs a new PipedInputStream connected to the PipedOutputStream out. Any data written to the output stream can be read from the this input stream.
Parameters:
  out - the PipedOutputStream to connect to.
throws:
  IOException - if this or out are already connected.




Method Detail
available
public synchronized int available() throws IOException(Code)
Answers a int representing the number of bytes that are available before this PipedInputStream will block. This method returns the number of bytes written to the pipe but not read yet up to the size of the pipe. int the number of bytes available before blocking.
throws:
  IOException - If an error occurs in this stream.



close
public void close() throws IOException(Code)
Close this PipedInputStream. This implementation releases the buffer used for the pipe and notifies all threads waiting to read or write.
throws:
  IOException - If an error occurs attempting to close this stream.



connect
public void connect(PipedOutputStream src) throws IOException(Code)
Connects this PipedInputStream to a PipedOutputStream. Any data written to the OutputStream becomes readable in this InputStream.
Parameters:
  src - the source PipedOutputStream.
throws:
  IOException - If either stream is already connected.



done
synchronized void done()(Code)



read
public synchronized int read() throws IOException(Code)
Reads a single byte from this PipedInputStream and returns the result as an int. The low-order byte is returned or -1 of the end of stream was encountered. If there is no data in the pipe, this method blocks until there is data available. Separate threads should be used for the reader of the PipedInputStream and the PipedOutputStream. There may be undesirable results if more than one Thread interacts a input or output pipe. int The byte read or -1 if end of stream.
throws:
  IOException - If the stream is already closed or another IOExceptionoccurs.



read
public synchronized int read(byte[] bytes, int offset, int count) throws IOException(Code)
Reads at most count bytes from this PipedInputStream and stores them in byte array buffer starting at offset. Answer the number of bytes actually read or -1 if no bytes were read and end of stream was encountered. Separate threads should be used for the reader of the PipedInputStream and the PipedOutputStream. There may be undesirable results if more than one Thread interacts a input or output pipe.
Parameters:
  bytes - the byte array in which to store the read bytes.
Parameters:
  offset - the offset in buffer to store the read bytes.
Parameters:
  count - the maximum number of bytes to store in buffer. the number of bytes actually read or -1 if end of stream.
throws:
  IOException - If the stream is already closed or another IOExceptionoccurs.



receive
protected synchronized void receive(int oneByte) throws IOException(Code)
Receives a byte and stores it into the PipedInputStream. This called by PipedOutputStream.write() when writes occur. The lowest-order byte is stored at index in in the buffer.

If the buffer is full and the thread sending #receive is interrupted, the InterruptedIOException will be thrown.
Parameters:
  oneByte - the byte to store into the pipe.
throws:
  IOException - If the stream is already closed or another IOExceptionoccurs.




Methods inherited from java.io.InputStream
public int available() throws IOException(Code)(Java Doc)
public void close() throws IOException(Code)(Java Doc)
public 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 offset, int length) 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
protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object object)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final public Class<? extends Object> getClass()(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
final public void notify()(Code)(Java Doc)
final public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final public void wait(long millis, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait(long millis) 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.