From 0736f19f4ea39b403d670bb20e191f2e27141021 Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Mon, 18 Oct 2004 13:40:05 +0000 Subject: BufferedInputStream.java: Fixed @author tag. 2004-10-18 Michael Koch * java/io/BufferedInputStream.java: Fixed @author tag. (read): Simplified expression. (read): Merged javadoc a bit more. (read): Renamed 'remain' to 'totalBytesRead'. * java/io/DataInputStream.java, java/io/DataOutputStream.java, java/io/ObjectInputStream.java, java/io/ObjectOutputStream.java: Reworked modifier order. From-SVN: r89218 --- libjava/java/io/BufferedInputStream.java | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'libjava/java/io/BufferedInputStream.java') diff --git a/libjava/java/io/BufferedInputStream.java b/libjava/java/io/BufferedInputStream.java index 3faaa6591d4..17c570f104b 100644 --- a/libjava/java/io/BufferedInputStream.java +++ b/libjava/java/io/BufferedInputStream.java @@ -1,5 +1,5 @@ /* BufferedInputStream.java -- An input stream that implements buffering - Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2001, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -60,12 +60,11 @@ package java.io; * does. * * @author Aaron M. Renn (arenn@urbanophile.com) - * @author Warren Levy - * @author Jeroen Frijters + * @author Warren Levy (warrenl@cygnus.com) + * @author Jeroen Frijters (jeroen@frijters.net) */ public class BufferedInputStream extends FilterInputStream { - /** * This is the default buffer size */ @@ -235,16 +234,16 @@ public class BufferedInputStream extends FilterInputStream if (markpos >= 0 && pos - markpos > marktarget) markpos = -1; - return ((int) buf[pos++]) & 0xFF; + return buf[pos++] & 0xFF; } /** * This method reads bytes from a stream and stores them into a caller * supplied buffer. It starts storing the data at index off * into the buffer and attempts to read len bytes. This method - * can return before reading the number of bytes requested. The actual - * number of bytes read is returned as an int. A -1 is returned to indicate - * the end of the stream. + * can return before reading the number of bytes requested. + * The actual number of bytes read is returned as an int. A -1 is returned + * to indicate the end of the stream. *

* This method will block until some data can be read. * @@ -267,14 +266,14 @@ public class BufferedInputStream extends FilterInputStream if (pos >= count && !refill()) return -1; // No bytes were read before EOF. - int remain = Math.min(count - pos, len); - System.arraycopy(buf, pos, b, off, remain); - pos += remain; + int totalBytesRead = Math.min(count - pos, len); + System.arraycopy(buf, pos, b, off, totalBytesRead); + pos += totalBytesRead; if (markpos >= 0 && pos - markpos > marktarget) markpos = -1; - return remain; + return totalBytesRead; } /** -- cgit v1.2.3