对于基于socket的inputstream而言,不像基于文件的流,除非socket关闭,否则是不会有EOF这个概念的(-1)

int bytesRead = 0;
            int bytesToRead = pageLength;

            while (bytesRead < bytesToRead) {
                int result = dis.read(buffer, bytesRead+4, bytesToRead    - bytesRead);
                if (result == -1)
                    break;
                bytesRead += result;
            }