Java LineNumberInputStream available() Example

LineNumberInputStream class available() method example. This example shows you how to use available() method.


Syntax is : public int available() throws IOException
Method returns the number of bytes that can be read from this input stream without blocking. This is deprecated method of deprecated class.

Here is the code.
/**
 * @(#) AvailableLineNumberInputStream.java
 * A class representing use of method available() of LineNumberInputStream 
 class in java.io Package. This is deprecated class in java 1.6 API.
 * @Version  04-June-2008
 @author   Rose India Team
 */
import java.io.*;
public class AvailableLineNumberInputStream {
     public static void main(String[] argsthrows IOException{

    /* Create object of StringBufferInputStream class. This is deprecated 
       class in java api 1.6. */
        StringBufferInputStream obj = new StringBufferInputStream("Mahendra");

    // Create object of LineNumberInputStream class.
    LineNumberInputStream objInputStream = new LineNumberInputStream(obj)

    // available() method call. 
    int byteCount = objInputStream.available();
    System.out.println("Number of bytes that can be read from the "
    +" input stream : " + byteCount);
    }
}

Output of the program.
Number of bytes that can be read from the  input stream : 4

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

HOME | COPYRIGHT | CONTACT US