本文整理匯總了Java中javax.microedition.io.Connector.openInputStream方法的典型用法代碼示例。如果您正苦於以下問題:Java Connector.openInputStream方法的具體用法?Java Connector.openInputStream怎麽用?Java Connector.openInputStream使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.microedition.io.Connector
的用法示例。
在下文中一共展示了Connector.openInputStream方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: readLines
import javax.microedition.io.Connector; //導入方法依賴的package包/類
/**
* Reads all the lines of a file into a given vector.
*
* @param file the file to read
* @param lines the vector to augment
*/
public static void readLines(String file, Vector lines) {
try {
InputStream is = Connector.openInputStream("file://" + file);
InputStreamReader isr = new InputStreamReader(is);
LineReader lr = new LineReader(isr);
lr.readLines(lines);
} catch (IOException ioe) {
ioe.printStackTrace();
throw new RuntimeException("Error while processing file '"+file+"': " + ioe);
}
}
示例2: readLines
import javax.microedition.io.Connector; //導入方法依賴的package包/類
/**
* Reads all the lines of a file into a given vector.
*
* @param file the file to read
* @param lines the vector to augment
*/
public static void readLines(String file, Vector lines) {
try {
InputStream is = Connector.openInputStream("file://" + file);
InputStreamReader isr = new InputStreamReader(is);
LineReader lr = new LineReader(isr);
lr.readLines(lines);
} catch (IOException ioe) {
throw new RuntimeException("Error while processing file '"+file+"': " + ioe);
}
}