看源码啊DataInputStream的read方法。
/**
* Reads some number of bytes from the contained input stream and
* stores them into the buffer array b. The number of
* bytes actually read is returned as an integer. This method blocks
* until input data is available, end of file is detected, or an
* exception is thrown.
public final int read(byte b[]) throws IOException {
return in.read(b, 0, b.length);
}
This method blocks
* until input data is available, end of file is detected, or an
* exception is thrown.
你第一次读,就把数据读完了,接下来没有可读的了。
/**
* Returns an estimate of the number of bytes that can be read (or
* skipped over) from this input stream without blocking by the next
* caller of a method for this input stream. The next caller might be
* the same thread or another thread. A single read or skip of this
* many bytes will not block, but may read or skip fewer bytes.
*
* This method returns the result of {@link #in in}.available().
*
* @return an estimate of the number of bytes that can be read (or skipped
* over) from this input stream without blocking.
* @exception IOException if an I/O error occurs.
*/
public int available() throws IOException {
return in.available();
}