java.lang.Object
|
+--java.lang.Throwable
|
+--java.lang.Exception
|
+--java.io.IOException
|
+--javax.microedition.io.ConnectionNotFoundException
- All Implemented Interfaces:
- Serializable
- See Also:
- Source Code
public ConnectionNotFoundException()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[1869]
By Anonymous on 2007/03/24 03:11:38 Rate
javax.microedition.io.ConnectionNotFoundException
public ConnectionNotFoundException(String s)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[374]Read input from a mobile device
By amarjeetk { at } noida { dot } hcltech { dot } com on 2003/11/23 05:59:37 Rate
mport java.io.*;
import javax.microedition.io.*;
public class TestInput {
public static void main ( String args [ ] ) {
try {
System.out.println ( "opening the file...." ) ;
String uri = "file:home/amarjeet/test.txt";
System.out.println ( uri ) ;
InputConnection conn = ( InputConnection )
Connector.open ( uri,
Connector.READ ) ;
System.out.println ( "connection established" ) ;
InputStream in = conn.openInputStream ( ) ;
int ch;
conn.close ( ) ; // doesn't close input stream!
System.out.println ( "Contents of [ " + uri +
" ] " ) ;
while ( ( ch = in.read ( ) ) != -1 ) {
System.out.print ( ( char ) ch ) ;
}
in.close ( ) ;
}
catch ( ConnectionNotFoundException e ) {
System.out.println ( e.toString ( ) ) ;
System.out.println ( "File could not be found!" ) ;
}
catch ( IOException e ) {
System.out.println ( e.toString ( ) ) ;
}
catch ( Exception e ) {
System.out.println ( e.toString ( ) ) ;
}
System.exit ( 0 ) ;
}
}