Index: Util.java =================================================================== RCS file: /data/cvs/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Util.java,v retrieving revision 1.27 diff -u -r1.27 Util.java --- Util.java 11 Mar 2003 15:03:56 -0000 1.27 +++ Util.java 12 Mar 2003 20:26:26 -0000 @@ -27,6 +27,7 @@ public class Util { + private static final int DEFAULT_READING_SIZE = 8192; public static String LINE_SEPARATOR = System.getProperty("line.separator"); //$NON-NLS-1$ public static char[] LINE_SEPARATOR_CHARS = LINE_SEPARATOR.toCharArray(); public final static char[] SUFFIX_class = ".class".toCharArray(); //$NON-NLS-1$ @@ -190,7 +191,7 @@ int contentsLength = 0; int bytesRead = -1; do { - int available = stream.available(); + int available = Math.max(stream.available(), DEFAULT_READING_SIZE); // resize contents if needed if (contentsLength + available > contents.length) { @@ -209,7 +210,7 @@ // remember length of contents contentsLength += bytesRead; } - } while (bytesRead > 0); + } while (bytesRead >= 0); // resize contents if necessary if (contentsLength < contents.length) { @@ -253,7 +254,7 @@ int contentsLength = 0; int charsRead = -1; do { - int available = stream.available(); + int available = Math.max(stream.available(), DEFAULT_READING_SIZE); // resize contents if needed if (contentsLength + available > contents.length) { @@ -272,7 +273,7 @@ // remember length of contents contentsLength += charsRead; } - } while (charsRead > 0); + } while (charsRead >= 0); // resize contents if necessary if (contentsLength < contents.length) {