Class PipedChannel
- java.lang.Object
-
- EDU.oswego.cs.dl.util.concurrent.SemaphoreControlledChannel
-
- EDU.oswego.cs.dl.util.concurrent.misc.PipedChannel
-
- All Implemented Interfaces:
BoundedChannel
,Channel
,Puttable
,Takable
public class PipedChannel extends SemaphoreControlledChannel
A channel based on a java.io.PipedInputStream and java.io.PipedOutputStream. Elements are serialized using ObjectInputStreams and ObjectOutputStreams upon insertion and extraction from the pipe.IO Exceptions are transformed into Errors. This is in general not a good idea, but seems to be the most reasonable compromise for the intended usage contexts.
Status Uncertain. There are enough conceptual and implementation snags surrounding use of pipes as Channels to downplay use. However, without such bridges, people would have to duplicate code that should work the same way in both cases.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.ObjectInputStream
in_
protected java.io.PipedInputStream
inp_
protected java.io.ObjectOutputStream
out_
protected java.io.PipedOutputStream
outp_
-
Fields inherited from class EDU.oswego.cs.dl.util.concurrent.SemaphoreControlledChannel
capacity_, putGuard_, takeGuard_
-
-
Constructor Summary
Constructors Constructor Description PipedChannel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Object
extract()
Shared mechanics for take-based methodsprotected java.io.ObjectInputStream
in()
Return input stream, first constructing if necessary.protected void
insert(java.lang.Object x)
Shared mechanics for put-based methodsprotected java.io.ObjectOutputStream
out()
Return output stream, first constructing if necessary.java.lang.Object
peek()
Stubbed out for now
-
-
-
Method Detail
-
in
protected java.io.ObjectInputStream in()
Return input stream, first constructing if necessary. Needed because Object streams can block on open.
-
out
protected java.io.ObjectOutputStream out()
Return output stream, first constructing if necessary. Needed because Object streams can block on open.
-
insert
protected void insert(java.lang.Object x)
Shared mechanics for put-based methods- Specified by:
insert
in classSemaphoreControlledChannel
-
extract
protected java.lang.Object extract()
Shared mechanics for take-based methods- Specified by:
extract
in classSemaphoreControlledChannel
-
peek
public java.lang.Object peek()
Stubbed out for now
-
-