Category Archives: Java

Java.io.Printstream Class in Java | Set 1

A PrintStream adds functionality to another output stream, namely the ability to print representations of various data values conveniently. Unlike other output streams, a PrintStream never throws an IOException; instead, exceptional situations merely set an internal flag that can be tested via the checkError method. Optionally, a PrintStream can be created so as to flush… Read More »

Java.io.PrintWriter class in Java | Set 2

Java.io.PrintWriter class in Java | Set 1 More methods: PrintWriter printf(Locale l, String format, Object… args) : A convenience method to write a formatted string to this writer using the specified format string and arguments. Syntax :public PrintWriter printf(Locale l, String format, Object… args) Parameters: l – The locale to apply during formatting. If l… Read More »

Java.io.PrintWriter class in Java | Set 1

This class gives Prints formatted representations of objects to a text-output stream. It implements all of the print methods found in PrintStream. It does not contain methods for writing raw bytes, for which a program should use unencoded byte streams. Unlike the PrintStream class, if automatic flushing is enabled it will be done only when… Read More »

Java.io.FileDescriptor in Java

java.io.FileDescriptor works for opening a file having a specific name. If there is any content present in that file it will first erase all that content and put “Beginning of Process” as the first line. Instances of the file descriptor class serve as an opaque handle to the underlying machine-specific structure representing an open file,… Read More »

Java.io.PipedReader Class in Java

This class is basically a piped character-input streams.In I/O Piped, simply means a link between two threads running in JVM at the same time. So, Pipes are used both as source or destination. A pipe is said to be broken if a thread that was providing data bytes to the connected piped output stream is… Read More »

Java.io.PipedWriter Class in Java

This class is basically a piped character-output streams. In I/O Piped, simply means a link between two threads running in JVM at the same time. So, Pipes are used both as source or destination. A pipe is said to be broken if a thread that was providing data bytes to the connected piped output stream… Read More »

Java.io.ByteArrayOutputStream() Class in Java

java.io.ByteArrayOutputStream class creates an Output Stream for writing data into byte array. The size of buffer grows automatically as data is written to it. There is no affect of closing the byteArrayOutputStream on the working of it’s methods. They can be called even after closing the class. Thus, no methods throws IO exception. Declaration: public… Read More »

Java.io.ByteArrayInputStream class in Java

java.io.ByteArrayInputStream class contains all the buffers, containing bytes to be read from the Input Stream. There is no IO exception in case of ByteArrayInputStream class methods. Methods of this class can be called even after closing the Stream, there is no effect of it on the class methods. Declaration : public class ByteArrayInputStream extends InputStream… Read More »

Java.io.Writer Class in Java

java.io.Writer class is an abstract class. It is used to write to character streams. Declaration : public abstract class Writer extends Object implements Appendable, Closeable, Flushable Constructors : protected Writer() : Creates a new character stream that can itself synchronize on the writer. protected Writer(Object obj) : Creates a new character stream that can itself… Read More »

Java.io.PipedOutputStream class in Java

Java.io.PipedInputStream class in Java Pipes in IO provides a link between two threads running in JVM at the same time. So, Pipes are used both as source or destination. PipedInputStream is also piped with PipedOutputStream. So, data can be written using PipedOutputStream and can be written using PipedInputStream.But, using both threads at the same time… Read More »

Java.io.PipedInputStream class in Java

Pipes in IO provides a link between two threads running in JVM at the same time. So, Pipes are used both as source or destination. PipedInputStream is also piped with PipedOutputStream. So, data can be written using PipedOutputStream and can be written using PipedInputStream.But, using both threads at the same time will create a deadlock… Read More »