php    php100   android
當前位置:首頁 » java.io包 »

Java.io.PipedInputStream類

評論  編輯

The java.util.PipedInputStream class is a piped input stream that can be connected to a piped output stream, the piped input stream then provides whatever data bytes are written to the piped output stream.Following are the important points about PipedInputStream:

  • The piped input stream contains a buffer, decoupling read operations from write operations, within limits.

  • Attempting to use both objects from a single thread is not recommended, as it may deadlock the thread.

  • A pipe is said to be broken if a thread that was providing data bytes to the connected piped output stream is no longer alive.

類聲明

以下是聲明java.util.PipedInputStream class:

public class PipedInputStream
  extends InputStream

字段域

Following are the fields for java.util.PipedInputStream class:

  • protected byte[] buffer -- This is the circular buffer into which incoming data is placed.

  • protected int in -- This is the index of the position in the circular buffer at which the next byte of data will be stored when received from the connected piped output stream.

  • protected int out -- This is the index of the position in the circular buffer at which the next byte of data will be read by this piped input stream.

  • protected static int PIPE_SIZE -- This is the default size of the pipe's circular input buffer.

類構造方法

S.N.構造方法 & 詳細描述
1PipedInputStream()
This creates a PipedInputStream so that it is not yet connected.
2PipedInputStream(int pipeSize)
This creates a PipedInputStream so that it is not yet connected and uses the specified pipe size for the pipe's buffer.
3PipedInputStream(PipedOutputStream src)
This creates a PipedInputStream so that it is connected to the piped output stream src.
4PipedInputStream(PipedOutputStream src, int pipeSize)
This creates a PipedInputStream so that it is connected to the piped output stream src and uses the specified pipe size for the pipe's buffer.

類方法

S.N.方法 & 描述
1 int available()
This method returns the number of bytes that can be read from this input stream without blocking.
2 void close()
This method closes this piped input stream and releases any system resources associated with the stream.
3 void connect(PipedOutputStream src)
This method causes this piped input stream to be connected to the piped output stream src.
4 int read()
This method reads the next byte of data from this piped input stream.
5 int read(byte[] b, int off, int len)
This method reads up to len bytes of data from this piped input stream into an array of bytes.
6 protected void receive(int b)
This method receives a byte of data.

方法繼承

此類從以下類繼承了上麵列出的方法

  • java.util.InputStream

  • java.util.Object


貢獻/合作者

正在開放中...
 

評論(條)

  • 還冇有評論!