SequenceInputStream available Example

SequenceInputStream class available example. This example shows you how to use available method.


SequenceInputStream class available example. public int available() throws IOException Returns an estimate of the number of bytes that can be read (or skipped over) from the current underlying input stream without blocking by the next invocation of a method for the current underlying input stream.

Here is the code

/**
 * @ # Available.java
 * A class reprsenting use to available method 
 * of SequenceInputStream class in java.io package
 * version 09 June 2008
 * author Rose India 
 */
import java.io.*;

public class Available {

    public static void main(String args[]) throws Exception {

        String s = "Rose";
        String s1 = "India";

        byte[] b = s.getBytes();
        byte[] b1 = s1.getBytes();

        ByteArrayInputStream inputStream1 = new ByteArrayInputStream(b);
        ByteArrayInputStream inputStream2 = new ByteArrayInputStream(b1);

        SequenceInputStream siStream = new SequenceInputStream(inputStream1, inputStream2);
        System.out.println("Current stream size " + siStream.available());
    }
}

Output
Current stream size 4

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US