পৃষ্ঠাসমূহ

Search Your Article

CS

 

Welcome to GoogleDG – your one-stop destination for free learning resources, guides, and digital tools.

At GoogleDG, we believe that knowledge should be accessible to everyone. Our mission is to provide readers with valuable ebooks, tutorials, and tech-related content that makes learning easier, faster, and more enjoyable.

What We Offer:

  • 📘 Free & Helpful Ebooks – covering education, technology, self-development, and more.

  • 💻 Step-by-Step Tutorials – practical guides on digital tools, apps, and software.

  • 🌐 Tech Updates & Tips – simplified information to keep you informed in the fast-changing digital world.

  • 🎯 Learning Support – resources designed to support students, professionals, and lifelong learners.

    Latest world News 

     

Our Vision

To create a digital knowledge hub where anyone, from beginners to advanced learners, can find trustworthy resources and grow their skills.

Why Choose Us?

✔ Simple explanations of complex topics
✔ 100% free access to resources
✔ Regularly updated content
✔ A community that values knowledge sharing

We are continuously working to expand our content library and provide readers with the most useful and relevant digital learning materials.

📩 If you’d like to connect, share feedback, or suggest topics, feel free to reach us through the Contact page.

Pageviews

Wednesday, January 18, 2017

Java.io.PipedInputStream Class

Introduction

The Java.io.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.

Class declaration

Following is the declaration for Java.io.PipedInputStream class:
public class PipedInputStream
  extends InputStream

Field

Following are the fields for Java.io.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.

Class constructors

S.N. Constructor & Description
1 PipedInputStream()
This creates a PipedInputStream so that it is not yet connected.
2 PipedInputStream(int pipeSize)
This creates a PipedInputStream so that it is not yet connected and uses the specified pipe size for the pipe's buffer.
3 PipedInputStream(PipedOutputStream src)
This creates a PipedInputStream so that it is connected to the piped output stream src.
4 PipedInputStream(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.

Class methods

S.N. Method & Description
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.

Methods inherited

This class inherits methods from the following classes:
  • Java.io.InputStream
  • Java.io.Object

No comments:

Post a Comment