首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

JDK 中高效率的实现

2012-10-07 
JDK 中高效的实现?记录一下?/*** See the general contract of the codereadInt/code* method of cod

JDK 中高效的实现

?

记录一下

?

/**     * See the general contract of the <code>readInt</code>     * method of <code>DataInput</code>.     * <p>     * Bytes     * for this operation are read from the contained     * input stream.     *     * @return     the next four bytes of this input stream, interpreted as an     *             <code>int</code>.     * @exception  EOFException  if this input stream reaches the end before     *               reading four bytes.     * @exception  IOException   the stream has been closed and the contained     *    input stream does not support reading after close, or     *    another I/O error occurs.     * @see        java.io.FilterInputStream#in     */    public final int readInt() throws IOException {        int ch1 = in.read();        int ch2 = in.read();        int ch3 = in.read();        int ch4 = in.read();        if ((ch1 | ch2 | ch3 | ch4) < 0)            throw new EOFException();        return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0));    } 

热点排行