统计信息，计算删除非0特征后，权重的长度

@throws IOException
354413
public void removeZero1(Linear cl) {
		HashFeatureAlphabet feature = (HashFeatureAlphabet) cl.getAlphabetFactory().DefaultFeatureAlphabet();
		float[] weights = cl.getWeights();
		boolean freeze = false;
		if (feature.isStopIncrement()) {
			feature.setStopIncrement(false);
			freeze = true;
		}

		TIntIntHashMap index = new TIntIntHashMap();
		TIntIntIterator it = feature.iterator();
		while (it.hasNext()) {
			it.advance();
			int value = it.key();
			int key = it.value();
			index.put(key, value);
		}
		int[] idx = index.keys();
		Arrays.sort(idx);
		int length = weights.length;
		HashFeatureAlphabet newfeat = new HashFeatureAlphabet();
		cl.getAlphabetFactory().setDefaultFeatureAlphabet(newfeat);
		TFloatArrayList ww = new TFloatArrayList();
		for (int i = 0; i < idx.length; i++) {
			int base = idx[i]; //一个特征段起始位置
			int end; //一个特征段结束位置
			if (i < idx.length - 1)
				end = idx[i + 1]; //对应下一个特征段起始位置
			else
				end  = length; //或者整个结束位置

			int interv = end - base;   //一个特征段长度
			float[] sw = new float[interv];
			for (int j = 0; j < interv; j++) {
				sw[j] = weights[base+j];
			}
			float var = MyArrays.viarance(sw);
			if (var>varsthresh) {
				int str = index.get(base);
				int id = newfeat.lookupIndex(str, interv);
				for (int j = 0; j < interv; j++) {
					ww.insert(id + j, weights[base + j]);
				}
			}else{
				//				System.out.print(".");	
			}

		}
		newfeat.setStopIncrement(freeze);
		cl.setWeights(ww.toArray());
		index.clear();
		ww.clear();
	}
371347
protected void init() throws IOException {
      if (internalIn2 != null) return;

      String encoding;
      byte bom[] = new byte[BOM_SIZE];
      int n, unread;
      n = internalIn.read(bom, 0, bom.length);

      if ( (bom[0] == (byte)0x00) && (bom[1] == (byte)0x00) &&
                  (bom[2] == (byte)0xFE) && (bom[3] == (byte)0xFF) ) {
         encoding = "UTF-32BE";
         unread = n - 4;
      } else if ( (bom[0] == (byte)0xFF) && (bom[1] == (byte)0xFE) &&
                  (bom[2] == (byte)0x00) && (bom[3] == (byte)0x00) ) {
         encoding = "UTF-32LE";
         unread = n - 4;
      } else if (  (bom[0] == (byte)0xEF) && (bom[1] == (byte)0xBB) &&
            (bom[2] == (byte)0xBF) ) {
         encoding = "UTF-8";
         unread = n - 3;
      } else if ( (bom[0] == (byte)0xFE) && (bom[1] == (byte)0xFF) ) {
         encoding = "UTF-16BE";
         unread = n - 2;
      } else if ( (bom[0] == (byte)0xFF) && (bom[1] == (byte)0xFE) ) {
         encoding = "UTF-16LE";
         unread = n - 2;
      } else {
         // Unicode BOM mark not found, unread all bytes
         encoding = defaultEnc;
         unread = n;
      }    
      //System.out.println("read=" + n + ", unread=" + unread);

      if (unread > 0) internalIn.unread(bom, (n - unread), unread);

      // Use given encoding
      if (encoding == null) {
         internalIn2 = new InputStreamReader(internalIn);
      } else {
         internalIn2 = new InputStreamReader(internalIn, encoding);
      }
   }
341502
private void doListen() throws IOException {
		while (0 != this.selector.select()) {
			// 返回已选择键的集合
			final Iterator<SelectionKey> keyIter = selector.selectedKeys().iterator();
			while (keyIter.hasNext()) {
				handle(keyIter.next());
				keyIter.remove();
			}
		}
	}
199516
public final int next() throws IOException {
        if (m_nextException!=null) {
            throw m_nextException;
        }
        try {
            return doNext();
        }
        catch (IOException e) {
            m_nextException=e;
            resetState();
            throw e;
        }
    }
785509
public String readLine() throws IOException {
        StringBuffer buf = new StringBuffer(80);
        int line = mLineNumber;
        int c;
        while (line == mLineNumber && (c = read()) >= 0) {
            buf.append((char)c);
        }
        return buf.toString();
    }
810594
public void info( String oinfo ) {
		//
		String methodName = moduleCode + "." + "info";
		//
		out.format( "%s%n", oinfo );
		//
		charsCount += oinfo.length();
		//
		String FOInfo = getFullInfoString( oinfo );
		//
		if ( !isFileOpen( methodName ) ) return;
		//
		outFile( FOInfo );
		//
        flushFile();
		//
	}
1252402
public int read() throws IOException {
        synchronized (lock) {
            ensureOpen();
            for (;;) {
                if (nextChar >= nChars) {
                    fill();
                    if (nextChar >= nChars)
                        return -1;
                }
                if (skipLF) {
                    skipLF = false;
                    if (cb[nextChar] == '\n') {
                        nextChar++;
                        continue;
                    }
                }
                return cb[nextChar++];
            }
        }
    }
574686
public String read() throws IOException {
        StringWriter out = new StringWriter();
        PrintWriter w = new PrintWriter(out);
        try (BufferedReader in = Files.newBufferedReader(Util.fileToPath(file), StandardCharsets.UTF_8)) {
            String line;
            while ((line = in.readLine()) != null)
                w.println(line);
        } catch (Exception e) {
            throw new IOException("Failed to fully read " + file, e);
        }
        return out.toString();
    }
170128
public synchronized int read() throws IOException
	{
		if (bytesUntilNextMetadata > 0)
		{
			bytesUntilNextMetadata--;
			return super.read();
		}
		else 
		if (bytesUntilNextMetadata == 0)
		{
			readMetadata();
			bytesUntilNextMetadata = metaint - 1;
			// -1 because we read byte on next line
			return super.read();
		}
		else
		{
			return super.read();
		}
	}
1255785
public synchronized int read() throws IOException
    {
        int b;
        if (_pos >=_avail)
            fill();
        if (_pos >=_avail)
            b=-1;
        else
            b=_buf[_pos++]&255;
        
        return b;
    }
1051797
protected void init() throws IOException {
		if (internalIn2 != null) return;

		String encoding;
		byte bom[] = new byte[BOM_SIZE];
		int n, unread;
		n = internalIn.read(bom, 0, bom.length);

		if ( (bom[0] == (byte)0x00) && (bom[1] == (byte)0x00) &&
				(bom[2] == (byte)0xFE) && (bom[3] == (byte)0xFF) ) {
			encoding = "UTF-32BE";
			unread = n - 4;
		} else if ( (bom[0] == (byte)0xFF) && (bom[1] == (byte)0xFE) &&
				(bom[2] == (byte)0x00) && (bom[3] == (byte)0x00) ) {
			encoding = "UTF-32LE";
			unread = n - 4;
		} else if (  (bom[0] == (byte)0xEF) && (bom[1] == (byte)0xBB) &&
				(bom[2] == (byte)0xBF) ) {
			encoding = "UTF-8";
			unread = n - 3;
		} else if ( (bom[0] == (byte)0xFE) && (bom[1] == (byte)0xFF) ) {
			encoding = "UTF-16BE";
			unread = n - 2;
		} else if ( (bom[0] == (byte)0xFF) && (bom[1] == (byte)0xFE) ) {
			encoding = "UTF-16LE";
			unread = n - 2;
		} else {
			// Unicode BOM not found, unread all bytes
			encoding = defaultEnc;
			unread = n;
		}

		if (unread > 0) internalIn.unread(bom, (n - unread), unread);

		// Use given encoding
		if (encoding == null) {
			internalIn2 = new InputStreamReader(internalIn);
		} else if (strict) {
			internalIn2 = new InputStreamReader(internalIn, Charset.forName(encoding).newDecoder());
		} else {
			internalIn2 = new InputStreamReader(internalIn, encoding);
		}
	}
839031
private void indent() throws IOException {
        if (indent>=0) {
            out.write('\n');
            for (int i=indent*2; i>0; ) {
                int len = Math.min(i,INDENT.length);
                out.write(INDENT,0,len);
                i-=len;
            }
        }
    }
274064
public int read() throws IOException {
        synchronized (lock) {
            ensureOpen();
            if (pos < buf.length)
                return buf[pos++];
            else
                return super.read();
        }
    }
164672
protected void init() throws IOException {
		if (isInited) {
			return;
		}

		byte bom[] = new byte[BOM_SIZE];
		int n, unread;
		n = in.read(bom, 0, bom.length);

		if ((bom[0] == (byte) 0x00) && (bom[1] == (byte) 0x00) && (bom[2] == (byte) 0xFE) && (bom[3] == (byte) 0xFF)) {
			charset = "UTF-32BE";
			unread = n - 4;
		} else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE) && (bom[2] == (byte) 0x00) && (bom[3] == (byte) 0x00)) {
			charset = "UTF-32LE";
			unread = n - 4;
		} else if ((bom[0] == (byte) 0xEF) && (bom[1] == (byte) 0xBB) && (bom[2] == (byte) 0xBF)) {
			charset = "UTF-8";
			unread = n - 3;
		} else if ((bom[0] == (byte) 0xFE) && (bom[1] == (byte) 0xFF)) {
			charset = "UTF-16BE";
			unread = n - 2;
		} else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE)) {
			charset = "UTF-16LE";
			unread = n - 2;
		} else {
			// Unicode BOM mark not found, unread all bytes
			charset = defaultCharset;
			unread = n;
		}
		// System.out.println("read=" + n + ", unread=" + unread);

		if (unread > 0) {
			in.unread(bom, (n - unread), unread);
		}

		isInited = true;
	}
62525
public void println(int i) throws IOException
  {
    String value = Integer.toString(i);
    this.output.write(value.getBytes(), 0, value.length());
    this.output.write(CRLF, 0, 2);
  }
196310
public int read() throws IOException {
    if (chunk == null || pos + 1 == chunk.length) {
      if (!fetchChunk()) {
        return -1;
      }
    }
    return chunk[pos++] & 0xff;
  }
524956
public String readLine() throws IOException {

        ensureOpen();

        StringBuilder sb = null;

        start = tempStart;

        firstRead = true;

        while (true) {

            tempLen = 0;
            ok = false;

            readString();
            // if (tempLen != 0)
            // System.out.println(new String(cb, tempOffe, tempLen));

            if (!isRead && (tempLen == 0 || len == 0)) {
                if (sb != null) {
                    return sb.toString();
                }
                return null;
            }

            if (!isRead) { // 如果不是需要读状态，那么返回
                tempStart += tempLen;
                if (sb == null) {
                    return new String(cb, tempOffe, tempLen);
                } else {
                    sb.append(cb, tempOffe, tempLen);
                    return sb.toString();
                }
            }

            if (tempLen == 0) {
                continue;
            }

            // 如果是需要读状态那么读取
            if (sb == null) {
                sb = new StringBuilder();
            }
            sb.append(cb, tempOffe, tempLen);
            tempStart += tempLen;
        }

    }