All About Class PipedOutputStream in Java

October 10, 2018

A PipedOutputStream is the transmitting end of a communication channel through pipe. Two threads can communicate by having one thread send the data through PipedInputStream and other thread read data through a PipedInputStream.
The class PipedInputStream is given as:

public class java.io.PipedOutputStream extends java.io.OutputStream{
//constructors
public PipedOutputStream();
//creates a PipedInputStream which is not yet connected to a PipedInputStream. It needs to be 
//connected to a PipedInputStream either by the receiver or the sender before being used.
public PipedOutputStream(PipedInputStream stm);
//creates a PipedInputStream which is connected to a PipedOutputStream stm.
//methods
public void close();
public void connect(PipedInputStream stm);
public void write(int b);
public void write(byte b[],int offSet,int length);
}
 
In addition, all methods may throw an IOException if an IO error occurs apart from their regular Exceptions.
All About Class PipedOutputStream in Java All About Class PipedOutputStream in Java Reviewed by Animesh Chatterjee on October 10, 2018 Rating: 5

All About Class PipedInputStream in Java

October 10, 2018


A PipedInputStream is the receiving end of the communication pipe.two threads can communicate by having one thread send the data through PipedInputStream  and other thread read data through a PipedInputStream.

The class PipedInputStream is given as:

public class java.io.PipedInputStream extends java.io.InputStream{
//constructors
public PipedInputStream();
//creates a PipedInputStream which is not yet connected to a PipedOutputStream. It needs to be 
//connected to a PipedOutputStream either by the receiver or the sender before being used.
public PipedInputStream(PipedOutputStream src);
//creates a PipedInputStream which is connected to a PipedOutputStream src..It may throw
//IOException if an I/o error occurs.
//methods
public void close();
public void connect(PipedOutputStream src);
public int read();
public int read(byte b[],int offSet,int length);
}
 
In addition,all methods may throw an IOException if an IO error occurs apart from their regular Exceptions.


All About Class PipedInputStream in Java All About Class PipedInputStream in Java Reviewed by Animesh Chatterjee on October 10, 2018 Rating: 5

All About Class OutputStream in Java

October 10, 2018


OutputStream class is an abstract super class of all classes that represent an output stream of bytes.An application that need to define a subclass of OutputStream must always provide at least a method that writes one byte of output.

The class structure of OutputStream is given as:

public abstract class java.io.OutputStream extends java.lang.Object{
//constructor
public OutputStream();
//default constructor
//methods:
public void close();//closes the input source;further read attempt on a closed input will generate
//an IOException.
public void flush();//flush the file buffer
public void write(byte b[]);//writes an entire byte array i.e block of bytes at a time.
public void write(byte b[],int offSet,int length);//write out length number of bytes from the block of 
//bytes b starting at offset offSet.
public abstract void write(int b);//writes one byte at a time
}
 
In addition,all methods may throw an IOException if an IO error occurs apart from their regular Exceptions.
All About Class OutputStream in Java All About Class OutputStream in Java Reviewed by Animesh Chatterjee on October 10, 2018 Rating: 5

All About Class FilterOutputStream in Java

October 10, 2018


FilterOutputStream  is the super class of all classes that filter output streams.These streams sit on top of an already existing output stream(the underlying output stream) but provides additional functionalities.
The class FilterOutputStream itself overrides all methods of OutputStream with versions that pass all requests to the underlying OutputStream.Subclasses of FilterOutputStream may further override some of these methods as well as provide additional methods and fields.
The structure of the class FilterOutputStream is given as:

public class java.io.FilterOutputStream extends java.io.OutputStream{
//member element
protected OutputStream out;
//The outputStream out is under consideration.
//constructor
public FilterOutputStream(OutputStream out);
//creates an output stream filter over the specified OutputStream
//methods
public void close();
public void flush();
public void write(byte b[]);
public void write(byte b[],int offSet,int length);
public void write(int b);
}
 
In addition,all methods may throw an IOException if an IO error occurs apart from their regular Exceptions.
All About Class FilterOutputStream in Java All About Class FilterOutputStream  in Java Reviewed by Animesh Chatterjee on October 10, 2018 Rating: 5

All About Class LineNumberInputStream in Java

October 10, 2018


A line is a sequence of bytes ending either a carriage return character("\r"),a new line character("\n") or a carriage return character followed immediately by a line feed character.In all these cases,the line terminating character(s) are returned as a single newline character.
LineNumberInputStream class is an input stream filter that provides the added functionality of keeping track of the current line number. The line number begins at zero and it is incremented by one when a read returns a newline character.

The structure of the class LineNumberInputStream is given as:

public class java.io.LineNumberInputStream extends java.io.FilterInputStream{
//constructor
public LineNumberInputStream(InputStream in);
//constructs a new LineNumberInputStream  which reads its input stream.
//methods
public int available();
public int read();
public int read(byte b[],int offSet,int length);
public long skip(long l);
public void mark(int readLimit);
public void reset();
public int getLineNumber();
public void setLineNumber(int lineNumber);
}
 
In addition,all methods may throw an IOException if an IO error occurs apart from their regular Exceptions.
All About Class LineNumberInputStream in Java All About Class LineNumberInputStream in Java Reviewed by Animesh Chatterjee on October 10, 2018 Rating: 5
Powered by Blogger.