java.lang.Object
java.io.Reader
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