KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > java > io > StringReader

java.io
Class StringReader

java.lang.Object
  extended by java.io.Reader
      extended by java.io.StringReader
All Implemented Interfaces:
Closeable, Readable
See Also:
Top Examples, Source Code

public void close()
See Also:
Reader, Closeable
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[75]Read character by character from a String
By Anonymous on 2002/10/10 17:41:15  Rate
 
 public static void main8 (  )  
  {  
   try 
    {  
     String data = "First line\nSecond line\nThird line"; 
     StringReader sr = new StringReader (  data  ) ; 
  
  
     int c = sr.read (  ) ; 
     while  (  c != -1  )  
      {  
        System.out.print (   ( char )  c  ) ; 
        c = sr.read (  ) ; 
      }  
      
     sr.close (  ) ; 
      
     System.out.println (  ) ; 
    }  
   catch  (  IOException e  )  
    {  
     System.out.println ( "IOException : " + e.getMessage (  )   ) ; 
    }  
  }  
 


public void mark(int readAheadLimit)
          throws IOException
See Also:
IllegalArgumentException, Reader
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean markSupported()
See Also:
Reader
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int read()
         throws IOException
See Also:
Reader
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int read(char[] cbuf,
                int off,
                int len)
         throws IOException
See Also:
Reader
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean ready()
              throws IOException
See Also:
Reader
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void reset()
           throws IOException
See Also:
Reader
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public long skip(long ns)
          throws IOException
See Also:
Reader
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public StringReader(String s)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags