當前位置: 首頁>>代碼示例>>Java>>正文


Java StreamTokenizer.toString方法代碼示例

本文整理匯總了Java中java.io.StreamTokenizer.toString方法的典型用法代碼示例。如果您正苦於以下問題:Java StreamTokenizer.toString方法的具體用法?Java StreamTokenizer.toString怎麽用?Java StreamTokenizer.toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.io.StreamTokenizer的用法示例。


在下文中一共展示了StreamTokenizer.toString方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: XYZChemModel

import java.io.StreamTokenizer; //導入方法依賴的package包/類
/** Create a Chemical model by parsing an input stream */
XYZChemModel(InputStream is) throws Exception {
    this();
    StreamTokenizer st = new StreamTokenizer(
            new BufferedReader(new InputStreamReader(is, "UTF-8")));
    st.eolIsSignificant(true);
    st.commentChar('#');

    try {
        scan:
        while (true) {
            switch (st.nextToken()) {
                case StreamTokenizer.TT_EOF:
                    break scan;
                default:
                    break;
                case StreamTokenizer.TT_WORD:
                    String name = st.sval;
                    double x = 0,
                     y = 0,
                     z = 0;
                    if (st.nextToken() == StreamTokenizer.TT_NUMBER) {
                        x = st.nval;
                        if (st.nextToken() == StreamTokenizer.TT_NUMBER) {
                            y = st.nval;
                            if (st.nextToken() == StreamTokenizer.TT_NUMBER) {
                                z = st.nval;
                            }
                        }
                    }
                    addVert(name, (float) x, (float) y, (float) z);
                    while (st.ttype != StreamTokenizer.TT_EOL
                            && st.ttype != StreamTokenizer.TT_EOF) {
                        st.nextToken();
                    }

            }   // end Switch

        }  // end while

        is.close();

    } // end Try
    catch (IOException e) {
    }

    if (st.ttype != StreamTokenizer.TT_EOF) {
        throw new Exception(st.toString());
    }

}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:52,代碼來源:XYZApp.java

示例2: errms

import java.io.StreamTokenizer; //導入方法依賴的package包/類
/**
 * Throws error message with line number and last token read.
 * 
 * @param theMsg the error message to be thrown
 * @param tokenizer the stream tokenizer
 * @throws IOException containing the error message
 */
public static void errms(StreamTokenizer tokenizer, String theMsg)
    throws IOException {

  throw new IOException(theMsg + ", read " + tokenizer.toString());
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:13,代碼來源:StreamTokenizerUtils.java

示例3: errms

import java.io.StreamTokenizer; //導入方法依賴的package包/類
/**
 * Throws error message with line number and last token read.
 * 
 * @param theMsg the error message to be thrown
 * @param tokenizer the stream tokenizer
 * @throws IOException containing the error message
 */
public static void errms(StreamTokenizer tokenizer, String theMsg)
  throws IOException {

  throw new IOException(theMsg + ", read " + tokenizer.toString());
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:13,代碼來源:ConverterUtils.java


注:本文中的java.io.StreamTokenizer.toString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。