当前位置: 首页>>代码示例>>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;未经允许,请勿转载。