Package org.nlpcn.commons.lang.util

Examples of org.nlpcn.commons.lang.util.FileIterator


    LOG.info("make basic tire begin !");

    forest = new SmartForest<Item>();

    FileIterator iteartor = IOUtil.instanceFileIterator(dicPath, IOUtil.UTF8);

    String[] split = null;

    try {
      String temp = null;

      while (iteartor.hasNext()) {
        temp = iteartor.next();

        if (StringUtil.isBlank(temp)) {
          continue;
        }

        split = temp.split("\t");

        Item item = cla.newInstance();

        item.init(split);

        forest.add(split[0], item);
      }
    } finally {
      if (iteartor != null)
        iteartor.close();
    }

    LOG.info("make basic tire over use time " + (System.currentTimeMillis() - start) + " ms");

    start = System.currentTimeMillis();
View Full Code Here


   * @throws IllegalAccessException
   * @throws InstantiationException
   */
  public static DoubleArrayTire loadText(InputStream is, Class<? extends Item> cla) throws InstantiationException, IllegalAccessException {
    DoubleArrayTire obj = new DoubleArrayTire();
    FileIterator it = IOUtil.instanceFileIterator(is, IOUtil.UTF8);
    String temp = it.next();
    obj.arrayLength = Integer.parseInt(temp);
    obj.dat = new Item[obj.arrayLength];
    Item item = null;
    while (it.hasNext()) {
      temp = it.next();
      item = cla.newInstance();
      item.initValue(temp.split("\t"));
      obj.dat[item.index] = item;
    }
    return obj;
View Full Code Here

TOP

Related Classes of org.nlpcn.commons.lang.util.FileIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.