当前位置: 首页>>代码示例>>Java>>正文


Java StreamTokenizer.whitespaceChars方法代码示例

本文整理汇总了Java中java.io.StreamTokenizer.whitespaceChars方法的典型用法代码示例。如果您正苦于以下问题:Java StreamTokenizer.whitespaceChars方法的具体用法?Java StreamTokenizer.whitespaceChars怎么用?Java StreamTokenizer.whitespaceChars使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.io.StreamTokenizer的用法示例。


在下文中一共展示了StreamTokenizer.whitespaceChars方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadCmdFile

import java.io.StreamTokenizer; //导入方法依赖的package包/类
private static void loadCmdFile(String name, ListBuffer<String> args)
    throws IOException
{
    Reader r = new BufferedReader(new FileReader(name));
    StreamTokenizer st = new StreamTokenizer(r);
    st.resetSyntax();
    st.wordChars(' ', 255);
    st.whitespaceChars(0, ' ');
    st.commentChar('#');
    st.quoteChar('"');
    st.quoteChar('\'');
    while (st.nextToken() != StreamTokenizer.TT_EOF) {
        args.append(st.sval);
    }
    r.close();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:CommandLine.java

示例2: loadCmdFile

import java.io.StreamTokenizer; //导入方法依赖的package包/类
private static void loadCmdFile(String name, List<String> args)
    throws IOException
{
    Reader r = new BufferedReader(new FileReader(name));
    StreamTokenizer st = new StreamTokenizer(r);
    st.resetSyntax();
    st.wordChars(' ', 255);
    st.whitespaceChars(0, ' ');
    st.commentChar('#');
    st.quoteChar('"');
    st.quoteChar('\'');
    while (st.nextToken() != StreamTokenizer.TT_EOF) {
        args.add(st.sval);
    }
    r.close();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:CommandLine.java

示例3: loadCmdFile

import java.io.StreamTokenizer; //导入方法依赖的package包/类
private static void loadCmdFile(String name, List args)
    throws IOException
{
    Reader r = new BufferedReader(new FileReader(name));
    StreamTokenizer st = new StreamTokenizer(r);
    st.resetSyntax();
    st.wordChars(' ', 255);
    st.whitespaceChars(0, ' ');
    st.commentChar('#');
    st.quoteChar('"');
    st.quoteChar('\'');
    while (st.nextToken() != st.TT_EOF) {
        args.add(st.sval);
    }
    r.close();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:CommandLine.java

示例4: parseArgsLine

import java.io.StreamTokenizer; //导入方法依赖的package包/类
/**
 * Parses a option line likes
 *    -genkaypair -dname "CN=Me"
 * and add the results into a list
 * @param list the list to fill into
 * @param s the line
 */
private static void parseArgsLine(List<String> list, String s)
        throws IOException, PropertyExpander.ExpandException {
    StreamTokenizer st = new StreamTokenizer(new StringReader(s));

    st.resetSyntax();
    st.whitespaceChars(0x00, 0x20);
    st.wordChars(0x21, 0xFF);
    // Everything is a word char except for quotation and apostrophe
    st.quoteChar('"');
    st.quoteChar('\'');

    while (true) {
        if (st.nextToken() == StreamTokenizer.TT_EOF) {
            break;
        }
        list.add(PropertyExpander.expand(st.sval));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:KeyStoreUtil.java

示例5: createTokenizer

import java.io.StreamTokenizer; //导入方法依赖的package包/类
/**
 * createTokenizer - build up StreamTokenizer for the command script
 * @param script command script to parsed
 * @return StreamTokenizer for command script
 */
private static StreamTokenizer createTokenizer(final String script) {
    final StreamTokenizer tokenizer = new StreamTokenizer(new StringReader(script));
    tokenizer.resetSyntax();
    // Default all characters to word.
    tokenizer.wordChars(0, 255);
    // Spaces and special characters are white spaces.
    tokenizer.whitespaceChars(0, ' ');
    // Ignore # comments.
    tokenizer.commentChar('#');
    // Handle double and single quote strings.
    tokenizer.quoteChar('"');
    tokenizer.quoteChar('\'');
    // Need to recognize the end of a command.
    tokenizer.eolIsSignificant(true);
    // Command separator.
    tokenizer.ordinaryChar(';');
    // Pipe separator.
    tokenizer.ordinaryChar('|');

    return tokenizer;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:CommandExecutor.java

示例6: setup

import java.io.StreamTokenizer; //导入方法依赖的package包/类
/**
 * Sets up the stream tokenizer
 */
private void setup() {
    st = new StreamTokenizer(this);
    st.resetSyntax();
    st.eolIsSignificant(false);
    st.lowerCaseMode(true);

    // Parse numbers as words
    st.wordChars('0', '9');
    st.wordChars('-', '.');

    // Characters as words
    st.wordChars('\u0000', '\u00FF');

    // Skip comments
    st.commentChar('%');

    // Skip whitespace and newlines
    st.whitespaceChars(' ', ' ');
    st.whitespaceChars('\u0009', '\u000e');
}
 
开发者ID:opprop-benchmarks,项目名称:matrix-toolkits-java,代码行数:24,代码来源:MatrixVectorReader.java

示例7: loadCmdFile

import java.io.StreamTokenizer; //导入方法依赖的package包/类
private static void loadCmdFile(String name, ListBuffer<String> args)
    throws IOException
{
    try (Reader r = Files.newBufferedReader(Paths.get(name))) {
        StreamTokenizer st = new StreamTokenizer(r);
        st.resetSyntax();
        st.wordChars(' ', 255);
        st.whitespaceChars(0, ' ');
        st.commentChar('#');
        st.quoteChar('"');
        st.quoteChar('\'');
        while (st.nextToken() != StreamTokenizer.TT_EOF) {
            args.append(st.sval);
        }
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:17,代码来源:CommandLine.java

示例8: openFile

import java.io.StreamTokenizer; //导入方法依赖的package包/类
private void openFile(File file) {
   try {
       st = new StreamTokenizer(           
           fr = new FileReader(file));
       st.eolIsSignificant(true);
       st.parseNumbers();
       st.whitespaceChars(' ', ' ');
       st.whitespaceChars('\t', '\t');
       char filesep = System.getProperty("file.separator").charAt(0);
       st.wordChars(filesep, filesep);
st.wordChars('/', '/');
       st.wordChars(':', ':');
       st.wordChars('_', '_');
   } catch (Exception e) {
       e.printStackTrace();
   }
}
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:18,代码来源:MixFile.java

示例9: initTokenizer

import java.io.StreamTokenizer; //导入方法依赖的package包/类
/**
 * Initializes the stream tokenizer.
 *
 * @param tokenizer the tokenizer to initialize
 */
private void initTokenizer(StreamTokenizer tokenizer) {
  tokenizer.resetSyntax();
  tokenizer.whitespaceChars(0, (' ' - 1));
  tokenizer.wordChars(' ', '\u00FF');
  tokenizer.whitespaceChars(m_FieldSeparator.charAt(0),
    m_FieldSeparator.charAt(0));
  // tokenizer.commentChar('%');

  String[] parts = m_Enclosures.split(",");
  for (String e : parts) {
    if (e.length() > 1 || e.length() == 0) {
      throw new IllegalArgumentException(
        "Enclosures can only be single characters");
    }
    tokenizer.quoteChar(e.charAt(0));
  }

  tokenizer.eolIsSignificant(true);
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:25,代码来源:CSVLoader.java

示例10: setSyntax

import java.io.StreamTokenizer; //导入方法依赖的package包/类
/**
 * This method sets the syntax of the StreamTokenizer. i.e. set the
 * whitespace, comment and delimit chars.
 * 
 */
protected void setSyntax(StreamTokenizer tk) {
  tk.resetSyntax();
  tk.eolIsSignificant(false);
  tk.slashStarComments(true);
  tk.slashSlashComments(true);
  tk.whitespaceChars(0, ' ');
  tk.wordChars(' ' + 1, '\u00ff');
  tk.ordinaryChar('[');
  tk.ordinaryChar(']');
  tk.ordinaryChar('{');
  tk.ordinaryChar('}');
  tk.ordinaryChar('-');
  tk.ordinaryChar('>');
  tk.ordinaryChar('/');
  tk.ordinaryChar('*');
  tk.quoteChar('"');
  tk.whitespaceChars(';', ';');
  tk.ordinaryChar('=');
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:25,代码来源:DotParser.java

示例11: createTokenizer

import java.io.StreamTokenizer; //导入方法依赖的package包/类
/**
 * Returns a new tokenizer for an OBJ or MTL stream.
 */
private static StreamTokenizer createTokenizer(Reader reader)
{
	StreamTokenizer tokenizer = new StreamTokenizer(reader);
	tokenizer.resetSyntax();
	tokenizer.eolIsSignificant(true);
	
	// All printable ASCII characters
	tokenizer.wordChars('!', '~');
	// Let's tolerate other ISO-8859-1 characters
	tokenizer.wordChars(0x80, 0xFF);
	
	tokenizer.whitespaceChars(' ', ' ');
	tokenizer.whitespaceChars('\n', '\n');
	tokenizer.whitespaceChars('\r', '\r');
	tokenizer.whitespaceChars('\t', '\t');
	return tokenizer;
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:21,代码来源:OBJLoader.java

示例12: initTokenizer

import java.io.StreamTokenizer; //导入方法依赖的package包/类
/**
 * Initializes the StreamTokenizer used for reading the ARFF file.
 */
private void initTokenizer(StreamTokenizer tokenizer) {
    tokenizer.resetSyntax();
    tokenizer.whitespaceChars(0, ' ');
    tokenizer.wordChars(' ' + 1, '\u00FF');
    tokenizer.whitespaceChars(',', ',');
    tokenizer.commentChar('%');
    tokenizer.quoteChar('"');
    tokenizer.quoteChar('\'');
    tokenizer.ordinaryChar('{');
    tokenizer.ordinaryChar('}');
    tokenizer.eolIsSignificant(true);
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:16,代码来源:ArffParser.java

示例13: createTokenizer

import java.io.StreamTokenizer; //导入方法依赖的package包/类
/**
* Creates a tokenizer for the specified string.
*/

  private StreamTokenizer createTokenizer(String str) {
     StreamTokenizer t = new StreamTokenizer(new StringReader(str));
     t.resetSyntax();
     t.wordChars((char) 33, (char) 126);
     t.ordinaryChar(':');
     t.ordinaryChar('/');
     t.quoteChar('"');
     t.quoteChar('\'');
     t.whitespaceChars(' ', ' ');
     t.whitespaceChars('\t', '\t');
     return t;
  }
 
开发者ID:eric-roberts,项目名称:JavaPPTX,代码行数:17,代码来源:OptionParser.java

示例14: loadCmdFile

import java.io.StreamTokenizer; //导入方法依赖的package包/类
private static void loadCmdFile(String name, ListBuffer<String> args)
        throws IOException {
    Reader r = new BufferedReader(new FileReader(name));
    StreamTokenizer st = new StreamTokenizer(r);
    st.resetSyntax();
    st.wordChars(' ', 255);
    st.whitespaceChars(0, ' ');
    st.commentChar('#');
    st.quoteChar('"');
    st.quoteChar('\'');
    while (st.nextToken() != st.TT_EOF) {
        args.append(st.sval);
    }
    r.close();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:16,代码来源:CommandLine.java

示例15: getCookieTokens

import java.io.StreamTokenizer; //导入方法依赖的package包/类
/**
 * Tokenizes a cookie header and returns the tokens in a
 * <code>Vector</code>.
 **/
private Vector getCookieTokens(String cookieHeader) {
    StringReader sr = new StringReader(cookieHeader);
    StreamTokenizer st = new StreamTokenizer(sr);
    Vector tokens = new Vector();

    // clear syntax tables of the StreamTokenizer
    st.resetSyntax();

    // set all characters as word characters
    st.wordChars(0,Character.MAX_VALUE);

    // set up characters for quoting
    st.quoteChar( '"' ); //double quotes
    st.quoteChar( '\'' ); //single quotes

    // set up characters to separate tokens
    st.whitespaceChars(59,59); //semicolon
    st.whitespaceChars(44,44); //comma

    try {
        while (st.nextToken() != StreamTokenizer.TT_EOF) {
            tokens.addElement( st.sval.trim() );
        }
    }
    catch (IOException ioe) {
        // this will never happen with a StringReader
    }
    sr.close();
    return tokens;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:35,代码来源:CookieJar.java


注:本文中的java.io.StreamTokenizer.whitespaceChars方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。