S. Nageswara Rao, Corporate Trainer

S. N. Rao has 20+ years hands on experience in Java and J2EE technologies. He has written 20+ books on java for students pursuing graduate and PG studies. Apart writing books, he is busy in taking corporate trainings.

SequenceInputStream Java

SequenceInputStream Java is used to copy a number of source files to one destination file. Many input streams are concatenated and converted into a single stream and copied at a stretch to the destination file. Merging of multiple files can be done easily in Java using SequenceInputStream. SequenceInputStream is a good example to show that …

SequenceInputStream Java Read More »

String Array Object String Array

String Array Object String Array Summary: By the end of this tutorial "String Array Object String Array", you will come to know how to create string array and converting object array to string array. String arrays play very important role in any language coding. In the following program, string arrays are created in three ways. …

String Array Object String Array Read More »

Converting Numbers to Words

Sometimes it is very much required in coding to convert numbers to words and print them as can be seen in Railway reservation tickets. Explained in "Converting Numbers to Words" with Java syntax. Following program illustrates "Converting Numbers to Words". import java.util.*; public class YourNumberMyWord { public void pw(int n,String ch) { String one[]={” “,” …

Converting Numbers to Words Read More »

Byte streams vs Character streams

Byte streams vs Character streams: Character streams Advantages over Byte streams Byte streams read bytes that fall under ASCII range and character streams read Unicode characters that include characters of many international languages. Being latest, introduced with JDK 1.1, the character streams are advantageous over byte streams like the inclusion of newLine() method (that is …

Byte streams vs Character streams Read More »

StreamTokenizer Tokenize Stream

Breaking a string or stream into meaningful independent words is known as tokenization. Tokenization is a common practice to tool developers. java.util package includes StringTokenizer which tokenizes a string into independent words. For StringTokenizer, the source is a string. There comes a similar tokenizer, StreamTokenize with java.io package for which source is a stream. Here, …

StreamTokenizer Tokenize Stream Read More »

Java Convert Byte Array Char Array

Java Convert Byte Array Char Array Summary: Explained in this tutorial "Java Convert Byte Array Char Array", converting in between byte array and char array in simple Java code. Sometimes it is very much required to convert byte array to char array and vice versa in coding. Following program illustrates the conversion of byte array …

Java Convert Byte Array Char Array Read More »

DataInputStream DataOutputStream File Copy

DataInputStream and DataOutputStream are high-level classes as they are the subclasses of FilterInputStream and FilterOutputStream. These streams' extra functionality is that they can read or write integers, doubles and lines at a time, instead of byte by byte. This increases the performance to some extent; instead of reading and writing byte by byte with FileInputStream …

DataInputStream DataOutputStream File Copy Read More »

Give Line Numbers LineNumberInputStream

Give Line Numbers LineNumberInputStream Summary: By the end of this tutorial "Give Line Numbers LineNumberInputStream", you will come to know how to give line numbers using Java I/O streams. LineNumberInputStream is a subclass of FilterInputStream stream. We know each filter stream adds some extra functionality. The LineNumberInputStream does the extra work of adding line numbers …

Give Line Numbers LineNumberInputStream Read More »

File Copy Tutorial Java

File Copy Tutorial Java: File copying operation, in Java, can be done in 5 steps broadly. Open the source file in read mode (say, using FileInputStream constructor) Open the destination file in write mode (say, using FileOutputStream constructor) Read data from the source file (say, using read() method) Write data to the destination file (say, …

File Copy Tutorial Java Read More »

Chaining Streams Java

Chaining Streams Java Java comes with low-level byte streams and high-level byte streams and similarly low-level and high-level character streams. Sub classes of FilterInputStream and FilterOutputStream are known as high-level streams. There are four high-level streams on input streams side – LineNumberInputStream, DataInputStream, BufferedInputStream and PushbackInputStream. The job of high-level streams is to add extra …

Chaining Streams Java Read More »

PipedInputStream PipedOutputStream

PipedInputStream PipedOutputStream – Transferring Data between Processes What is pipe? A pipe is a transferring channel though which data flows. Pipe is a conduit to send data of an output stream to an input stream. Generally, a thread connected to PipedOutputStream sends data to another thread connected to PipedInputStream. To transfer data between two running …

PipedInputStream PipedOutputStream Read More »