harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r492652 [6/13] - /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/
Date Thu, 04 Jan 2007 17:47:05 GMT
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InputStreamReader.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InputStreamReader.java?view=diff&rev=492652&r1=492651&r2=492652
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InputStreamReader.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InputStreamReader.java Thu Jan  4 09:47:01 2007
@@ -39,7 +39,6 @@
  * from the source input stream and converts these into characters as needed.
  * The buffer size is 8K.
  * 
- * 
  * @see OutputStreamWriter
  */
 public class InputStreamReader extends Reader {
@@ -143,7 +142,6 @@
      * Close this InputStreamReader. This implementation closes the source
      * InputStream and releases all local storage.
      * 
-     * 
      * @throws IOException
      *             If an error occurs attempting to close this
      *             InputStreamReader.
@@ -344,9 +342,10 @@
     @Override
     public int read() throws IOException {
         synchronized (lock) {
-            if (!isOpen())
+            if (!isOpen()) {
                 // K0070=InputStreamReader is closed.
                 throw new IOException(Msg.getString("K0070")); //$NON-NLS-1$
+            }
 
             char buf[] = new char[1];
             return read(buf, 0, 1) != -1 ? buf[0] : -1;
@@ -376,86 +375,93 @@
     @Override
     public int read(char[] buf, int offset, int length) throws IOException {
         synchronized (lock) {
-            if (isOpen()) {
-                if (offset < 0 || offset > buf.length - length || length < 0) {
-                    throw new IndexOutOfBoundsException();
+            if (!isOpen()) {
+                // K0070=InputStreamReader is closed.
+                throw new IOException(Msg.getString("K0070")); //$NON-NLS-1$
+            }
+            if (offset < 0 || offset > buf.length - length || length < 0) {
+                throw new IndexOutOfBoundsException();
+            }
+            if (length == 0) {
+                return 0;
+            }
+
+            CharBuffer out = CharBuffer.wrap(buf, offset, length);
+            CoderResult result = CoderResult.UNDERFLOW;
+            byte[] a = bytes.array();
+            boolean has_been_read = false;
+
+            if (!bytes.hasRemaining() || bytes.limit() == bytes.capacity()) {
+                // Nothing is available in the buffer...
+                if (!bytes.hasRemaining()) {
+                    bytes.clear();
                 }
-                if (length == 0) {
-                    return 0;
+                int readed = in.read(a, bytes.arrayOffset(), bytes.remaining());
+                if (readed == -1) {
+                    endOfInput = true;
+                    return -1;
                 }
-				
-	            CharBuffer out = CharBuffer.wrap(buf, offset, length);
-	            CoderResult result = CoderResult.UNDERFLOW;
-	            byte[] a = bytes.array();
-	            boolean has_been_read = false;
-
-	            
-	            if(!bytes.hasRemaining() || bytes.limit() == bytes.capacity()) {
-		            // Nothing is available in the buffer...
-	            	if(!bytes.hasRemaining())
-		            bytes.clear();
-		            int readed = in.read(a, bytes.arrayOffset(), bytes.remaining());
-		            if(readed == -1) {
-			            endOfInput = true;
-			            return -1;
-		            }
-		            bytes.limit(readed);
-		            has_been_read = true;
-	            }
-	            while (out.hasRemaining()) {
-                    if (bytes.hasRemaining()) {
-                        result = decoder.decode(bytes, out, false);
-                        if (!bytes.hasRemaining() && endOfInput) {
-                            decoder.decode(bytes, out, true);
-                            decoder.flush(out);
-                            decoder.reset();
-                            break;
-                        }
-                        if(!out.hasRemaining() || bytes.position() == bytes.limit())
+                bytes.limit(readed);
+                has_been_read = true;
+            }
+
+            while (out.hasRemaining()) {
+                if (bytes.hasRemaining()) {
+                    result = decoder.decode(bytes, out, false);
+                    if (!bytes.hasRemaining() && endOfInput) {
+                        decoder.decode(bytes, out, true);
+                        decoder.flush(out);
+                        decoder.reset();
+                        break;
+                    }
+                    if (!out.hasRemaining()
+                            || bytes.position() == bytes.limit()) {
                         bytes.compact();
-                    } 
-                    if(in.available() > 0 && (!has_been_read && out.hasRemaining()) || out.position() == 0 ) {
-	                    bytes.compact();
-	                    int to_read = bytes.remaining();
-	                    int off = bytes.arrayOffset() + bytes.position();
-	
-	                    to_read = in.read(a, off, to_read);
-	                    if (to_read == -1) {
-	                    	if(bytes.hasRemaining())
-	                    	bytes.flip();
-	                        endOfInput = true;
-	                        break;
-	                    }
-	                    has_been_read = true;
-						if(to_read > 0) {
-							bytes.limit(bytes.position()+to_read);
-							bytes.position(0);
-						}
-					} else 
-						break;
- 	            }
-
- 	            if(result == CoderResult.UNDERFLOW && endOfInput) {
-	 	            result = decoder.decode(bytes, out, true);
-                            // FIXME: should flush at first, but seems ICU has a bug that 
-                            // it will throw IAE if some malform/unmappable bytes found during
-                            // decoding
-                            //   result = decoder.flush(chars);
-	 	            decoder.reset();
-	            }
- 	            if(result.isMalformed()) {
- 	                throw new MalformedInputException(result.length());
- 	            }else if(result.isUnmappable()){
- 	                throw new UnmappableCharacterException(result.length());
- 	            }
-	            if(result == CoderResult.OVERFLOW && bytes.position()!=0) 
-	            	bytes.flip();
-	            
-	            return out.position() - offset == 0 ? -1 : out.position() - offset;
-				
+                    }
+                }
+                if (in.available() > 0
+                        && (!has_been_read && out.hasRemaining())
+                        || out.position() == 0) {
+                    bytes.compact();
+                    int to_read = bytes.remaining();
+                    int off = bytes.arrayOffset() + bytes.position();
+
+                    to_read = in.read(a, off, to_read);
+                    if (to_read == -1) {
+                        if (bytes.hasRemaining()) {
+                            bytes.flip();
+                        }
+                        endOfInput = true;
+                        break;
+                    }
+                    has_been_read = true;
+                    if (to_read > 0) {
+                        bytes.limit(bytes.position() + to_read);
+                        bytes.position(0);
+                    }
+                } else {
+                    break;
+                }
             }
-            // K0070=InputStreamReader is closed.
-            throw new IOException(Msg.getString("K0070")); //$NON-NLS-1$
+
+            if (result == CoderResult.UNDERFLOW && endOfInput) {
+                result = decoder.decode(bytes, out, true);
+                // FIXME: should flush at first, but seems ICU has a bug that it
+                // will throw IAE if some malform/unmappable bytes found during
+                // decoding
+                // result = decoder.flush(chars);
+                decoder.reset();
+            }
+            if (result.isMalformed()) {
+                throw new MalformedInputException(result.length());
+            } else if (result.isUnmappable()) {
+                throw new UnmappableCharacterException(result.length());
+            }
+            if (result == CoderResult.OVERFLOW && bytes.position() != 0) {
+                bytes.flip();
+            }
+
+            return out.position() - offset == 0 ? -1 : out.position() - offset;
         }
     }
 
@@ -492,8 +498,7 @@
                 throw new IOException(Msg.getString("K0070")); //$NON-NLS-1$
             }
             try {
-	        return bytes.limit() != BUFFER_SIZE
-                || in.available() > 0;
+                return bytes.limit() != BUFFER_SIZE || in.available() > 0;
             } catch (IOException e) {
                 return false;
             }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InterruptedIOException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InterruptedIOException.java?view=diff&rev=492652&r1=492651&r2=492652
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InterruptedIOException.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InterruptedIOException.java Thu Jan  4 09:47:01 2007
@@ -17,41 +17,37 @@
 
 package java.io;
 
-
 /**
  * This IO exception is thrown when a program reading or writing to a stream is
  * interrupted. This is also thrown when a socket timeout occurs before the
  * request has completed.
- * 
  */
 public class InterruptedIOException extends IOException {
-    
+
     private static final long serialVersionUID = 4020568460727500567L;
-    
-	/**
-	 * The number of bytes transferred before the IO interrupt occurred. The
-	 * default is 0 but the value may be filled in by the caller of the
-	 * constructor.
-	 */
-	public int bytesTransferred;
 
-	/**
-	 * Constructs a new instance of this class with its walkback filled in.
-	 * 
-	 */
-	public InterruptedIOException() {
-		super();
-	}
+    /**
+     * The number of bytes transferred before the IO interrupt occurred. The
+     * default is 0 but the value may be filled in by the caller of the
+     * constructor.
+     */
+    public int bytesTransferred;
 
-	/**
-	 * Constructs a new instance of this class with its walkback and message
-	 * filled in.
-	 * 
-	 * @param detailMessage
-	 *            The detail message for the exception.
-	 */
-	public InterruptedIOException(String detailMessage) {
-		super(detailMessage);
-	}
+    /**
+     * Constructs a new instance of this class with its walkback filled in.
+     */
+    public InterruptedIOException() {
+        super();
+    }
 
+    /**
+     * Constructs a new instance of this class with its walkback and message
+     * filled in.
+     * 
+     * @param detailMessage
+     *            The detail message for the exception.
+     */
+    public InterruptedIOException(String detailMessage) {
+        super(detailMessage);
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InvalidClassException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InvalidClassException.java?view=diff&rev=492652&r1=492651&r2=492652
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InvalidClassException.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InvalidClassException.java Thu Jan  4 09:47:01 2007
@@ -83,5 +83,4 @@
         }
         return msg;
     }
-
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InvalidObjectException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InvalidObjectException.java?view=diff&rev=492652&r1=492651&r2=492652
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InvalidObjectException.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/InvalidObjectException.java Thu Jan  4 09:47:01 2007
@@ -17,7 +17,6 @@
 
 package java.io;
 
-
 /**
  * The object graph loaded (deserialized) can be validated by a collection of
  * validator objects. If these decide the validation fails, then will throw
@@ -28,17 +27,16 @@
  */
 public class InvalidObjectException extends ObjectStreamException {
 
-	private static final long serialVersionUID = 3233174318281839583L;
-
-	/**
-	 * Constructs a new instance of this class with its walkback and message
-	 * filled in.
-	 * 
-	 * @param detailMessage
-	 *            The detail message for the exception.
-	 */
-	public InvalidObjectException(String detailMessage) {
-		super(detailMessage);
-	}
+    private static final long serialVersionUID = 3233174318281839583L;
 
+    /**
+     * Constructs a new instance of this class with its walkback and message
+     * filled in.
+     * 
+     * @param detailMessage
+     *            The detail message for the exception.
+     */
+    public InvalidObjectException(String detailMessage) {
+        super(detailMessage);
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberInputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberInputStream.java?view=diff&rev=492652&r1=492651&r2=492652
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberInputStream.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberInputStream.java Thu Jan  4 09:47:01 2007
@@ -15,7 +15,7 @@
  *  limitations under the License.
  */
 
-package java.io; 
+package java.io;
 
 /**
  * LineNumberInputStream is a filter class which counts the number of line
@@ -27,222 +27,223 @@
  */
 @Deprecated
 public class LineNumberInputStream extends FilterInputStream {
-	private int lineNumber;
 
-	private int markedLineNumber = -1;
+    private int lineNumber;
+
+    private int markedLineNumber = -1;
+
+    private int lastChar = -1;
 
-	private int lastChar = -1;
-    
     private int markedLastChar;
 
-	/**
-	 * Constructs a new LineNumberInputStream on the InputStream <code>in</code>.
-	 * All reads are now filtered through this stream and line numbers will be
-	 * counted for all data read from this Stream.
-	 * 
-	 * @param in
-	 *            The non-null InputStream to count line numbers.
-	 */
-	public LineNumberInputStream(InputStream in) {
-		super(in);
-	}
-
-	/**
-	 * Answers a int representing the number of bytes that are available before
-	 * this LineNumberInputStream will block. This method returns the number of
-	 * bytes available in the target stream. Since the target input stream may
-	 * just be a sequence of <code>\r\n</code> characters and this filter only
-	 * returns <code>\n<code> then <code>available</code> can only
-	 * guarantee <code>target.available()/2</code> characters.
-	 *
-	 * @return 		int			the number of bytes available before blocking.
-	 *
-	 * @throws 		IOException	If an error occurs in this stream.
-	 */
-	@Override
+    /**
+     * Constructs a new LineNumberInputStream on the InputStream <code>in</code>.
+     * All reads are now filtered through this stream and line numbers will be
+     * counted for all data read from this Stream.
+     * 
+     * @param in
+     *            The non-null InputStream to count line numbers.
+     */
+    public LineNumberInputStream(InputStream in) {
+        super(in);
+    }
+
+    /**
+     * Answers a int representing the number of bytes that are available before
+     * this LineNumberInputStream will block. This method returns the number of
+     * bytes available in the target stream. Since the target input stream may
+     * just be a sequence of <code>\r\n</code> characters and this filter only
+     * returns <code>\n<code> then <code>available</code> can only
+     * guarantee <code>target.available()/2</code> characters.
+     *
+     * @return 		int			the number of bytes available before blocking.
+     *
+     * @throws 		IOException	If an error occurs in this stream.
+     */
+    @Override
     public int available() throws IOException {
-		return in.available() / 2 + (lastChar == -1 ? 0 : 1);
-	}
+        return in.available() / 2 + (lastChar == -1 ? 0 : 1);
+    }
 
-	/**
-	 * Answers a int representing the current line number for this
-	 * LineNumberInputStream.
-	 * 
-	 * @return int the current line number.
-	 */
-	public int getLineNumber() {
-		return lineNumber;
-	}
-
-	/**
-	 * Set a Mark position in this LineNumberInputStream. The parameter
-	 * <code>readLimit</code> indicates how many bytes can be read before a
-	 * mark is invalidated. Sending reset() will reposition the Stream back to
-	 * the marked position provided <code>readLimit</code> has not been
-	 * surpassed. The lineNumber count will also be reset to the last marked
-	 * lineNumber count.
-	 * <p>
-	 * This implementation sets a mark in the target stream.
-	 * 
-	 * @param readlimit
-	 *            The number of bytes to be able to read before invalidating the
-	 *            mark.
-	 */
-	@Override
+    /**
+     * Answers a int representing the current line number for this
+     * LineNumberInputStream.
+     * 
+     * @return int the current line number.
+     */
+    public int getLineNumber() {
+        return lineNumber;
+    }
+
+    /**
+     * Set a Mark position in this LineNumberInputStream. The parameter
+     * <code>readLimit</code> indicates how many bytes can be read before a
+     * mark is invalidated. Sending reset() will reposition the Stream back to
+     * the marked position provided <code>readLimit</code> has not been
+     * surpassed. The lineNumber count will also be reset to the last marked
+     * lineNumber count.
+     * <p>
+     * This implementation sets a mark in the target stream.
+     * 
+     * @param readlimit
+     *            The number of bytes to be able to read before invalidating the
+     *            mark.
+     */
+    @Override
     public void mark(int readlimit) {
-		in.mark(readlimit);
-		markedLineNumber = lineNumber;
-		markedLastChar = lastChar;
-	}
-
-	/**
-	 * Reads a single byte from this LineNumberInputStream and returns the
-	 * result as an int. The low-order byte is returned or -1 of the end of
-	 * stream was encountered. This implementation returns a byte from the
-	 * target stream. The line number count is incremented if a line terminator
-	 * is encountered. A line delimiter sequence is determined by '\r', '\n', or
-	 * '\r\n'. In this method, the sequence is always translated into '\n'.
-	 * 
-	 * @return int The byte read or -1 if end of stream.
-	 * 
-	 * @throws IOException
-	 *             If the stream is already closed or another IOException
-	 *             occurs.
-	 */
-	@Override
+        in.mark(readlimit);
+        markedLineNumber = lineNumber;
+        markedLastChar = lastChar;
+    }
+
+    /**
+     * Reads a single byte from this LineNumberInputStream and returns the
+     * result as an int. The low-order byte is returned or -1 of the end of
+     * stream was encountered. This implementation returns a byte from the
+     * target stream. The line number count is incremented if a line terminator
+     * is encountered. A line delimiter sequence is determined by '\r', '\n', or
+     * '\r\n'. In this method, the sequence is always translated into '\n'.
+     * 
+     * @return int The byte read or -1 if end of stream.
+     * 
+     * @throws IOException
+     *             If the stream is already closed or another IOException
+     *             occurs.
+     */
+    @Override
     public int read() throws IOException {
-		int currentChar = lastChar;
-		if (currentChar == -1) {
+        int currentChar = lastChar;
+        if (currentChar == -1) {
             currentChar = in.read();
         } else {
             lastChar = -1;
         }
-		switch (currentChar) {
-		case '\r':
-			currentChar = '\n';
-			lastChar = in.read();
-			if (lastChar == '\n') {
-                lastChar = -1;
-            }
-            // fall through
-		case '\n':
-			lineNumber++;
-		}
-		return currentChar;
-	}
-
-	/**
-	 * Reads at most <code>length</code> bytes from this LineNumberInputStream
-	 * and stores them in byte array <code>buffer</code> starting at
-	 * <code>offset</code>. Answer the number of bytes actually read or -1 if
-	 * no bytes were read and end of stream was encountered. This implementation
-	 * reads bytes from the target stream. The line number count is incremented
-	 * if a line terminator is encountered. A line delimiter sequence is
-	 * determined by '\r', '\n', or '\r\n'. In this method, the sequence is
-	 * always translated into '\n'.
-	 * 
-	 * @param buffer
-	 *            the non-null byte array in which to store the read bytes.
-	 * @param offset
-	 *            the offset in <code>buffer</code> to store the read bytes.
-	 * @param length
-	 *            the maximum number of bytes to store in <code>buffer</code>.
-	 * @return The number of bytes actually read or -1 if end of stream.
-	 * 
-	 * @throws IOException
-	 *             If the stream is already closed or another IOException
-	 *             occurs.
-	 * @throws NullPointerException
-	 *             If <code>buffer</code> is <code>null</code>.
-	 * @throws IllegalArgumentException
-	 *             If <code>offset</code> or <code>count</code> are out of
-	 *             bounds.
-	 */
-	@Override
+        switch (currentChar) {
+            case '\r':
+                currentChar = '\n';
+                lastChar = in.read();
+                if (lastChar == '\n') {
+                    lastChar = -1;
+                }
+                // fall through
+            case '\n':
+                lineNumber++;
+        }
+        return currentChar;
+    }
+
+    /**
+     * Reads at most <code>length</code> bytes from this LineNumberInputStream
+     * and stores them in byte array <code>buffer</code> starting at
+     * <code>offset</code>. Answer the number of bytes actually read or -1 if
+     * no bytes were read and end of stream was encountered. This implementation
+     * reads bytes from the target stream. The line number count is incremented
+     * if a line terminator is encountered. A line delimiter sequence is
+     * determined by '\r', '\n', or '\r\n'. In this method, the sequence is
+     * always translated into '\n'.
+     * 
+     * @param buffer
+     *            the non-null byte array in which to store the read bytes.
+     * @param offset
+     *            the offset in <code>buffer</code> to store the read bytes.
+     * @param length
+     *            the maximum number of bytes to store in <code>buffer</code>.
+     * @return The number of bytes actually read or -1 if end of stream.
+     * 
+     * @throws IOException
+     *             If the stream is already closed or another IOException
+     *             occurs.
+     * @throws NullPointerException
+     *             If <code>buffer</code> is <code>null</code>.
+     * @throws IllegalArgumentException
+     *             If <code>offset</code> or <code>count</code> are out of
+     *             bounds.
+     */
+    @Override
     public int read(byte[] buffer, int offset, int length) throws IOException {
-		if (buffer != null) {
-			// avoid int overflow
-			if (0 <= offset && offset <= buffer.length && 0 <= length
-					&& length <= buffer.length - offset) {
-				for (int i = 0; i < length; i++) {
-					int currentChar;
-					try {
-						currentChar = read();
-					} catch (IOException e) {
-						if (i != 0) {
-                            return i;
-                        }
-						throw e;
-					}
-					if (currentChar == -1) {
-                        return i == 0 ? -1 : i;
-                    }
-					buffer[offset + i] = (byte) currentChar;
-				}
-				return length;
-			}
-			throw new ArrayIndexOutOfBoundsException();
-		}
-		throw new NullPointerException();
-	}
-
-	/**
-	 * Reset this LineNumberInputStream to the last marked location. If the
-	 * <code>readlimit</code> has been passed or no <code>mark</code> has
-	 * been set, throw IOException. This implementation resets the target
-	 * stream. It also resets the line count to what is was when this Stream was
-	 * marked.
-	 * 
-	 * @throws IOException
-	 *             If the stream is already closed or another IOException
-	 *             occurs.
-	 */
-	@Override
+        if (buffer == null) {
+            throw new NullPointerException();
+        }
+        // avoid int overflow
+        if (offset < 0 || offset > buffer.length || length < 0
+                || length > buffer.length - offset) {
+            throw new ArrayIndexOutOfBoundsException();
+        }
+
+        for (int i = 0; i < length; i++) {
+            int currentChar;
+            try {
+                currentChar = read();
+            } catch (IOException e) {
+                if (i != 0) {
+                    return i;
+                }
+                throw e;
+            }
+            if (currentChar == -1) {
+                return i == 0 ? -1 : i;
+            }
+            buffer[offset + i] = (byte) currentChar;
+        }
+        return length;
+    }
+
+    /**
+     * Reset this LineNumberInputStream to the last marked location. If the
+     * <code>readlimit</code> has been passed or no <code>mark</code> has
+     * been set, throw IOException. This implementation resets the target
+     * stream. It also resets the line count to what is was when this Stream was
+     * marked.
+     * 
+     * @throws IOException
+     *             If the stream is already closed or another IOException
+     *             occurs.
+     */
+    @Override
     public void reset() throws IOException {
-		in.reset();
-		lineNumber = markedLineNumber;
-		lastChar = markedLastChar;
-	}
-
-	/**
-	 * Sets the lineNumber of this LineNumberInputStream to the specified
-	 * <code>lineNumber</code>. Note that this may have side effects on the
-	 * line number associated with the last marked position.
-	 * 
-	 * @param lineNumber
-	 *            the new lineNumber value.
-	 */
-	public void setLineNumber(int lineNumber) {
-		this.lineNumber = lineNumber;
-	}
-
-	/**
-	 * Skips <code>count</code> number of bytes in this InputStream.
-	 * Subsequent <code>read()</code>'s will not return these bytes unless
-	 * <code>reset()</code> is used. This implementation skips
-	 * <code>count</code> number of bytes in the target stream and increments
-	 * the lineNumber count as bytes are skipped.
-	 * 
-	 * @param count
-	 *            the number of bytes to skip.
-	 * @return the number of bytes actually skipped.
-	 * 
-	 * @throws IOException
-	 *             If the stream is already closed or another IOException
-	 *             occurs.
-	 */
-	@Override
+        in.reset();
+        lineNumber = markedLineNumber;
+        lastChar = markedLastChar;
+    }
+
+    /**
+     * Sets the lineNumber of this LineNumberInputStream to the specified
+     * <code>lineNumber</code>. Note that this may have side effects on the
+     * line number associated with the last marked position.
+     * 
+     * @param lineNumber
+     *            the new lineNumber value.
+     */
+    public void setLineNumber(int lineNumber) {
+        this.lineNumber = lineNumber;
+    }
+
+    /**
+     * Skips <code>count</code> number of bytes in this InputStream.
+     * Subsequent <code>read()</code>'s will not return these bytes unless
+     * <code>reset()</code> is used. This implementation skips
+     * <code>count</code> number of bytes in the target stream and increments
+     * the lineNumber count as bytes are skipped.
+     * 
+     * @param count
+     *            the number of bytes to skip.
+     * @return the number of bytes actually skipped.
+     * 
+     * @throws IOException
+     *             If the stream is already closed or another IOException
+     *             occurs.
+     */
+    @Override
     public long skip(long count) throws IOException {
-		if (count <= 0) {
+        if (count <= 0) {
             return 0;
         }
-		for (int i = 0; i < count; i++) {
-			int currentChar = read();
-			if (currentChar == -1) {
+        for (int i = 0; i < count; i++) {
+            int currentChar = read();
+            if (currentChar == -1) {
                 return i;
             }
-		}
-		return count;
-	}
-
+        }
+        return count;
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberReader.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberReader.java?view=diff&rev=492652&r1=492651&r2=492652
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberReader.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberReader.java Thu Jan  4 09:47:01 2007
@@ -15,8 +15,7 @@
  *  limitations under the License.
  */
 
-package java.io; 
-
+package java.io;
 
 /**
  * LineNumberReader is a buffered character input reader which counts line
@@ -26,252 +25,253 @@
  * @see BufferedWriter
  */
 public class LineNumberReader extends BufferedReader {
-	private int lineNumber;
 
-	private int markedLineNumber = -1;
+    private int lineNumber;
+
+    private int markedLineNumber = -1;
+
+    private boolean lastWasCR;
 
-	private boolean lastWasCR;
-    
     private boolean markedLastWasCR;
 
-	/**
-	 * Constructs a new buffered LineNumberReader on the Reader <code>in</code>.
-	 * The default buffer size (8K) is allocated and all reads can now be
-	 * filtered through this LineNumberReader.
-	 * 
-	 * @param in
-	 *            the Reader to buffer reads on.
-	 */
-	public LineNumberReader(Reader in) {
-		super(in);
-	}
-
-	/**
-	 * Constructs a new buffered LineNumberReader on the Reader <code>in</code>.
-	 * The buffer size is specified by the parameter <code>size</code> and all
-	 * reads can now be filtered through this LineNumberReader.
-	 * 
-	 * @param in
-	 *            the Reader to buffer reads on.
-	 * @param size
-	 *            the size of buffer to allocate.
-	 */
-	public LineNumberReader(Reader in, int size) {
-		super(in, size);
-	}
-
-	/**
-	 * Answers a int representing the current line number for this
-	 * LineNumberReader.
-	 * 
-	 * @return int the current line number.
-	 */
-	public int getLineNumber() {
-		synchronized (lock) {
-			return lineNumber;
-		}
-	}
-
-	/**
-	 * Set a Mark position in this LineNumberReader. The parameter
-	 * <code>readLimit</code> indicates how many characters can be read before
-	 * a mark is invalidated. Sending reset() will reposition the reader back to
-	 * the marked position provided <code>readLimit</code> has not been
-	 * surpassed. The lineNumber associated with this marked position will also
-	 * be saved and restored when reset() is sent provided
-	 * <code>readLimit</code> has not been surpassed.
-	 * 
-	 * @param readlimit
-	 *            an int representing how many characters must be read before
-	 *            invalidating the mark.
-	 * 
-	 * @throws IOException
-	 *             If an error occurs attempting mark this LineNumberReader.
-	 */
-	@Override
+    /**
+     * Constructs a new buffered LineNumberReader on the Reader <code>in</code>.
+     * The default buffer size (8K) is allocated and all reads can now be
+     * filtered through this LineNumberReader.
+     * 
+     * @param in
+     *            the Reader to buffer reads on.
+     */
+    public LineNumberReader(Reader in) {
+        super(in);
+    }
+
+    /**
+     * Constructs a new buffered LineNumberReader on the Reader <code>in</code>.
+     * The buffer size is specified by the parameter <code>size</code> and all
+     * reads can now be filtered through this LineNumberReader.
+     * 
+     * @param in
+     *            the Reader to buffer reads on.
+     * @param size
+     *            the size of buffer to allocate.
+     */
+    public LineNumberReader(Reader in, int size) {
+        super(in, size);
+    }
+
+    /**
+     * Answers a int representing the current line number for this
+     * LineNumberReader.
+     * 
+     * @return int the current line number.
+     */
+    public int getLineNumber() {
+        synchronized (lock) {
+            return lineNumber;
+        }
+    }
+
+    /**
+     * Set a Mark position in this LineNumberReader. The parameter
+     * <code>readLimit</code> indicates how many characters can be read before
+     * a mark is invalidated. Sending reset() will reposition the reader back to
+     * the marked position provided <code>readLimit</code> has not been
+     * surpassed. The lineNumber associated with this marked position will also
+     * be saved and restored when reset() is sent provided
+     * <code>readLimit</code> has not been surpassed.
+     * 
+     * @param readlimit
+     *            an int representing how many characters must be read before
+     *            invalidating the mark.
+     * 
+     * @throws IOException
+     *             If an error occurs attempting mark this LineNumberReader.
+     */
+    @Override
     public void mark(int readlimit) throws IOException {
-		synchronized (lock) {
-			super.mark(readlimit);
-			markedLineNumber = lineNumber;
-			markedLastWasCR = lastWasCR;
-		}
-	}
-
-	/**
-	 * Reads a single char from this LineNumberReader and returns the result as
-	 * an int. The low-order 2 bytes are returned or -1 of the end of reader was
-	 * encountered. This implementation returns a char from the target reader.
-	 * The line number count is incremented if a line terminator is encountered.
-	 * A line delimiter sequence is determined by '\r', '\n', or '\r\n'. In this
-	 * method, the sequence is always translated into '\n'.
-	 * 
-	 * @return int The char read or -1 if end of reader.
-	 * 
-	 * @throws IOException
-	 *             If the reader is already closed or another IOException
-	 *             occurs.
-	 */
-	@Override
+        synchronized (lock) {
+            super.mark(readlimit);
+            markedLineNumber = lineNumber;
+            markedLastWasCR = lastWasCR;
+        }
+    }
+
+    /**
+     * Reads a single char from this LineNumberReader and returns the result as
+     * an int. The low-order 2 bytes are returned or -1 of the end of reader was
+     * encountered. This implementation returns a char from the target reader.
+     * The line number count is incremented if a line terminator is encountered.
+     * A line delimiter sequence is determined by '\r', '\n', or '\r\n'. In this
+     * method, the sequence is always translated into '\n'.
+     * 
+     * @return int The char read or -1 if end of reader.
+     * 
+     * @throws IOException
+     *             If the reader is already closed or another IOException
+     *             occurs.
+     */
+    @Override
     public int read() throws IOException {
-		synchronized (lock) {
-			int ch = super.read();
-			if (ch == '\n' && lastWasCR) {
+        synchronized (lock) {
+            int ch = super.read();
+            if (ch == '\n' && lastWasCR) {
                 ch = super.read();
             }
-			lastWasCR = false;
-			switch (ch) {
-			case '\r':
-				ch = '\n';
-				lastWasCR = true;
-			// fall through
-			case '\n':
-				lineNumber++;
-			}
-			return ch;
-		}
-	}
-
-	/**
-	 * Reads at most <code>count</code> chars from this LineNumberReader and
-	 * stores them in char array <code>buffer</code> starting at offset
-	 * <code>offset</code>. Answer the number of chars actually read or -1 if
-	 * no chars were read and end of reader was encountered. This implementation
-	 * reads chars from the target stream. The line number count is incremented
-	 * if a line terminator is encountered. A line delimiter sequence is
-	 * determined by '\r', '\n', or '\r\n'. In this method, the sequence is
-	 * always translated into '\n'.
-	 * 
-	 * @param buffer
-	 *            the char array in which to store the read chars.
-	 * @param offset
-	 *            the offset in <code>buffer</code> to store the read chars.
-	 * @param count
-	 *            the maximum number of chars to store in <code>buffer</code>.
-	 * @return the number of chars actually read or -1 if end of reader.
-	 * 
-	 * @throws IOException
-	 *             If the reader is already closed or another IOException
-	 *             occurs.
-	 */
+            lastWasCR = false;
+            switch (ch) {
+                case '\r':
+                    ch = '\n';
+                    lastWasCR = true;
+                    // fall through
+                case '\n':
+                    lineNumber++;
+            }
+            return ch;
+        }
+    }
+
+    /**
+     * Reads at most <code>count</code> chars from this LineNumberReader and
+     * stores them in char array <code>buffer</code> starting at offset
+     * <code>offset</code>. Answer the number of chars actually read or -1 if
+     * no chars were read and end of reader was encountered. This implementation
+     * reads chars from the target stream. The line number count is incremented
+     * if a line terminator is encountered. A line delimiter sequence is
+     * determined by '\r', '\n', or '\r\n'. In this method, the sequence is
+     * always translated into '\n'.
+     * 
+     * @param buffer
+     *            the char array in which to store the read chars.
+     * @param offset
+     *            the offset in <code>buffer</code> to store the read chars.
+     * @param count
+     *            the maximum number of chars to store in <code>buffer</code>.
+     * @return the number of chars actually read or -1 if end of reader.
+     * 
+     * @throws IOException
+     *             If the reader is already closed or another IOException
+     *             occurs.
+     */
 
-	@Override
+    @Override
     public int read(char[] buffer, int offset, int count) throws IOException {
-		synchronized (lock) {
-			int read = super.read(buffer, offset, count);
-			if (read == -1) {
+        synchronized (lock) {
+            int read = super.read(buffer, offset, count);
+            if (read == -1) {
                 return -1;
             }
-			for (int i = 0; i < read; i++) {
-				char ch = buffer[offset + i];
-				if (ch == '\r') {
-					lineNumber++;
-					lastWasCR = true;
-				} else if (ch == '\n') {
-					if (!lastWasCR) {
+            for (int i = 0; i < read; i++) {
+                char ch = buffer[offset + i];
+                if (ch == '\r') {
+                    lineNumber++;
+                    lastWasCR = true;
+                } else if (ch == '\n') {
+                    if (!lastWasCR) {
                         lineNumber++;
                     }
-					lastWasCR = false;
-				} else {
+                    lastWasCR = false;
+                } else {
                     lastWasCR = false;
                 }
-			}
-			return read;
-		}
-	}
-
-	/**
-	 * Answers a <code>String</code> representing the next line of text
-	 * available in this LineNumberReader. A line is represented by 0 or more
-	 * characters followed by <code>'\n'</code>, <code>'\r'</code>,
-	 * <code>"\n\r"</code> or end of stream. The <code>String</code> does
-	 * not include the newline sequence.
-	 * 
-	 * @return String the contents of the line or null if no characters were
-	 *         read before end of stream.
-	 * 
-	 * @throws IOException
-	 *             If the LineNumberReader is already closed or some other IO
-	 *             error occurs.
-	 */
-	@Override
+            }
+            return read;
+        }
+    }
+
+    /**
+     * Answers a <code>String</code> representing the next line of text
+     * available in this LineNumberReader. A line is represented by 0 or more
+     * characters followed by <code>'\n'</code>, <code>'\r'</code>,
+     * <code>"\n\r"</code> or end of stream. The <code>String</code> does
+     * not include the newline sequence.
+     * 
+     * @return String the contents of the line or null if no characters were
+     *         read before end of stream.
+     * 
+     * @throws IOException
+     *             If the LineNumberReader is already closed or some other IO
+     *             error occurs.
+     */
+    @Override
     public String readLine() throws IOException {
-		synchronized (lock) {
-			/* Typical Line Length */
+        synchronized (lock) {
+            /* Typical Line Length */
             StringBuilder result = new StringBuilder(80);
-			while (true) {
-				int character = read();
-				if (character == -1) {
+            while (true) {
+                int character = read();
+                if (character == -1) {
                     return result.length() != 0 ? result.toString() : null;
                 }
-				if (character == '\n') {
+                if (character == '\n') {
                     return result.toString();
                 }
-				result.append((char) character);
-			}
-		}
-	}
-
-	/**
-	 * Reset this LineNumberReader to the last marked location. If the
-	 * <code>readlimit</code> has been passed or no <code>mark</code> has
-	 * been set, throw IOException. This implementation resets the target
-	 * reader. It also resets the line count to what is was when this reader was
-	 * marked.
-	 * 
-	 * @throws IOException
-	 *             If the reader is already closed or another IOException
-	 *             occurs.
-	 */
-	@Override
+                result.append((char) character);
+            }
+        }
+    }
+
+    /**
+     * Reset this LineNumberReader to the last marked location. If the
+     * <code>readlimit</code> has been passed or no <code>mark</code> has
+     * been set, throw IOException. This implementation resets the target
+     * reader. It also resets the line count to what is was when this reader was
+     * marked.
+     * 
+     * @throws IOException
+     *             If the reader is already closed or another IOException
+     *             occurs.
+     */
+    @Override
     public void reset() throws IOException {
-		synchronized (lock) {
-			super.reset();
-			lineNumber = markedLineNumber;
-			lastWasCR = markedLastWasCR;
-		}
-	}
-
-	/**
-	 * Sets the lineNumber of this LineNumberReader to the specified
-	 * <code>lineNumber</code>. Note that this may have side effects on the
-	 * line number associated with the last marked position.
-	 * 
-	 * @param lineNumber
-	 *            the new lineNumber value.
-	 */
-	public void setLineNumber(int lineNumber) {
-		synchronized (lock) {
-			this.lineNumber = lineNumber;
-		}
-	}
-
-	/**
-	 * Skips <code>count</code> number of chars in this LineNumberReader.
-	 * Subsequent <code>read()</code>'s will not return these chars unless
-	 * <code>reset()</code> is used. This implementation skips
-	 * <code>count</code> number of chars in the target stream and increments
-	 * the lineNumber count as chars are skipped.
-	 * 
-	 * @param count
-	 *            the number of chars to skip.
-	 * @return the number of chars actually skipped.
-	 * 
-	 * @throws IOException
-	 *             If the reader is already closed or another IOException
-	 *             occurs.
-	 */
-	@Override
+        synchronized (lock) {
+            super.reset();
+            lineNumber = markedLineNumber;
+            lastWasCR = markedLastWasCR;
+        }
+    }
+
+    /**
+     * Sets the lineNumber of this LineNumberReader to the specified
+     * <code>lineNumber</code>. Note that this may have side effects on the
+     * line number associated with the last marked position.
+     * 
+     * @param lineNumber
+     *            the new lineNumber value.
+     */
+    public void setLineNumber(int lineNumber) {
+        synchronized (lock) {
+            this.lineNumber = lineNumber;
+        }
+    }
+
+    /**
+     * Skips <code>count</code> number of chars in this LineNumberReader.
+     * Subsequent <code>read()</code>'s will not return these chars unless
+     * <code>reset()</code> is used. This implementation skips
+     * <code>count</code> number of chars in the target stream and increments
+     * the lineNumber count as chars are skipped.
+     * 
+     * @param count
+     *            the number of chars to skip.
+     * @return the number of chars actually skipped.
+     * 
+     * @throws IOException
+     *             If the reader is already closed or another IOException
+     *             occurs.
+     */
+    @Override
     public long skip(long count) throws IOException {
-		if (count >= 0) {
-			synchronized (lock) {
-				for (int i = 0; i < count; i++) {
-                    if (read() == -1) {
-                        return i;
-                    }
+        if (count < 0) {
+            throw new IllegalArgumentException();
+        }
+        synchronized (lock) {
+            for (int i = 0; i < count; i++) {
+                if (read() == -1) {
+                    return i;
                 }
-				return count;
-			}
-		}
-		throw new IllegalArgumentException();
-	}
+            }
+            return count;
+        }
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/NotActiveException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/NotActiveException.java?view=diff&rev=492652&r1=492651&r2=492652
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/NotActiveException.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/NotActiveException.java Thu Jan  4 09:47:01 2007
@@ -17,7 +17,6 @@
 
 package java.io;
 
-
 /**
  * Some methods in ObjectInputStream and ObjectOutputStream can only be called
  * from a nested call to readObject() or writeObject(). Any attempt to call them
@@ -35,24 +34,23 @@
  */
 public class NotActiveException extends ObjectStreamException {
 
-	private static final long serialVersionUID = -3893467273049808895L;
-
-	/**
-	 * Constructs a new instance of this class with its walkback filled in.
-	 */
-	public NotActiveException() {
-		super();
-	}
+    private static final long serialVersionUID = -3893467273049808895L;
 
-	/**
-	 * Constructs a new instance of this class with its walkback and message
-	 * filled in.
-	 * 
-	 * @param detailMessage
-	 *            The detail message for the exception.
-	 */
-	public NotActiveException(String detailMessage) {
-		super(detailMessage);
-	}
+    /**
+     * Constructs a new instance of this class with its walkback filled in.
+     */
+    public NotActiveException() {
+        super();
+    }
 
+    /**
+     * Constructs a new instance of this class with its walkback and message
+     * filled in.
+     * 
+     * @param detailMessage
+     *            The detail message for the exception.
+     */
+    public NotActiveException(String detailMessage) {
+        super(detailMessage);
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/NotSerializableException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/NotSerializableException.java?view=diff&rev=492652&r1=492651&r2=492652
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/NotSerializableException.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/NotSerializableException.java Thu Jan  4 09:47:01 2007
@@ -17,7 +17,6 @@
 
 package java.io;
 
-
 /**
  * When an implementation of ObjectOutput.writeObject() is passed an object that
  * is not serializable, it will throw this type of exception. This can happen if
@@ -31,25 +30,24 @@
  */
 public class NotSerializableException extends ObjectStreamException {
 
-	private static final long serialVersionUID = 2906642554793891381L;
-
-	/**
-	 * Constructs a new instance of this class with its walkback filled in.
-	 * 
-	 */
-	public NotSerializableException() {
-		super();
-	}
+    private static final long serialVersionUID = 2906642554793891381L;
 
-	/**
-	 * Constructs a new instance of this class with its walkback and message
-	 * filled in.
-	 * 
-	 * @param detailMessage
-	 *            The detail message for the exception.
-	 */
-	public NotSerializableException(String detailMessage) {
-		super(detailMessage);
-	}
+    /**
+     * Constructs a new instance of this class with its walkback filled in.
+     * 
+     */
+    public NotSerializableException() {
+        super();
+    }
 
+    /**
+     * Constructs a new instance of this class with its walkback and message
+     * filled in.
+     * 
+     * @param detailMessage
+     *            The detail message for the exception.
+     */
+    public NotSerializableException(String detailMessage) {
+        super(detailMessage);
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInput.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInput.java?view=diff&rev=492652&r1=492651&r2=492652
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInput.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInput.java Thu Jan  4 09:47:01 2007
@@ -15,8 +15,7 @@
  *  limitations under the License.
  */
 
-package java.io; 
-
+package java.io;
 
 /**
  * Streams to be used with serialization to read objects must implement this
@@ -26,97 +25,97 @@
  * @see ObjectOutput
  */
 public interface ObjectInput extends DataInput {
-	/**
-	 * Answers a int representing then number of bytes of primitive data that
-	 * are available.
-	 * 
-	 * @return int the number of primitive bytes available.
-	 * 
-	 * @throws IOException
-	 *             If an error occurs in this ObjectInput.
-	 */
-	public int available() throws IOException;
-
-	/**
-	 * Close this ObjectInput. Concrete implementations of this class should
-	 * free any resources during close.
-	 * 
-	 * @throws IOException
-	 *             If an error occurs attempting to close this ObjectInput.
-	 */
-	public void close() throws IOException;
-
-	/**
-	 * Reads a single byte from this ObjectInput and returns the result as an
-	 * int. The low-order byte is returned or -1 of the end of stream was
-	 * encountered.
-	 * 
-	 * @return int The byte read or -1 if end of ObjectInput.
-	 * 
-	 * @throws IOException
-	 *             If the ObjectInput is already closed or another IOException
-	 *             occurs.
-	 */
-	public int read() throws IOException;
-
-	/**
-	 * Reads bytes from the <code>ObjectInput</code> and stores them in byte
-	 * array <code>buffer</code>. Blocks while waiting for input.
-	 * 
-	 * @param buffer
-	 *            the array in which to store the read bytes.
-	 * @return how many bytes were read or <code>-1</code> if encountered end
-	 *         of <code>ObjectInput</code>.
-	 * 
-	 * @throws IOException
-	 *             If the <code>ObjectInput</code> is already closed or
-	 *             another IOException occurs.
-	 */
-	public int read(byte[] buffer) throws IOException;
-
-	/**
-	 * Reads at most <code>count</code> bytes from the ObjectInput and stores
-	 * them in byte array <code>buffer</code> starting at offset
-	 * <code>count</code>. Answer the number of bytes actually read or -1 if
-	 * no bytes were read and end of ObjectInput was encountered.
-	 * 
-	 * @param buffer
-	 *            the byte array in which to store the read bytes.
-	 * @param offset
-	 *            the offset in <code>buffer</code> to store the read bytes.
-	 * @param count
-	 *            the maximum number of bytes to store in <code>buffer</code>.
-	 * @return the number of bytes actually read or -1 if end of ObjectInput.
-	 * 
-	 * @throws IOException
-	 *             If the ObjectInput is already closed or another IOException
-	 *             occurs.
-	 */
-	public int read(byte[] buffer, int offset, int count) throws IOException;
-
-	/**
-	 * Reads the next object from this ObjectInput.
-	 * 
-	 * @return the next object read from this ObjectInput
-	 * 
-	 * @throws IOException
-	 *             If an error occurs attempting to read from this ObjectInput.
-	 * @throws ClassNotFoundException
-	 *             If the object's class cannot be found
-	 */
-	public Object readObject() throws ClassNotFoundException, IOException;
-
-	/**
-	 * Skips <code>toSkip</code> number of bytes in this ObjectInput.
-	 * Subsequent <code>read()</code>'s will not return these bytes.
-	 * 
-	 * @param toSkip
-	 *            the number of bytes to skip.
-	 * @return the number of bytes actually skipped.
-	 * 
-	 * @throws IOException
-	 *             If the ObjectInput is already closed or another IOException
-	 *             occurs.
-	 */
-	public long skip(long toSkip) throws IOException;
+    /**
+     * Answers a int representing then number of bytes of primitive data that
+     * are available.
+     * 
+     * @return int the number of primitive bytes available.
+     * 
+     * @throws IOException
+     *             If an error occurs in this ObjectInput.
+     */
+    public int available() throws IOException;
+
+    /**
+     * Close this ObjectInput. Concrete implementations of this class should
+     * free any resources during close.
+     * 
+     * @throws IOException
+     *             If an error occurs attempting to close this ObjectInput.
+     */
+    public void close() throws IOException;
+
+    /**
+     * Reads a single byte from this ObjectInput and returns the result as an
+     * int. The low-order byte is returned or -1 of the end of stream was
+     * encountered.
+     * 
+     * @return int The byte read or -1 if end of ObjectInput.
+     * 
+     * @throws IOException
+     *             If the ObjectInput is already closed or another IOException
+     *             occurs.
+     */
+    public int read() throws IOException;
+
+    /**
+     * Reads bytes from the <code>ObjectInput</code> and stores them in byte
+     * array <code>buffer</code>. Blocks while waiting for input.
+     * 
+     * @param buffer
+     *            the array in which to store the read bytes.
+     * @return how many bytes were read or <code>-1</code> if encountered end
+     *         of <code>ObjectInput</code>.
+     * 
+     * @throws IOException
+     *             If the <code>ObjectInput</code> is already closed or
+     *             another IOException occurs.
+     */
+    public int read(byte[] buffer) throws IOException;
+
+    /**
+     * Reads at most <code>count</code> bytes from the ObjectInput and stores
+     * them in byte array <code>buffer</code> starting at offset
+     * <code>count</code>. Answer the number of bytes actually read or -1 if
+     * no bytes were read and end of ObjectInput was encountered.
+     * 
+     * @param buffer
+     *            the byte array in which to store the read bytes.
+     * @param offset
+     *            the offset in <code>buffer</code> to store the read bytes.
+     * @param count
+     *            the maximum number of bytes to store in <code>buffer</code>.
+     * @return the number of bytes actually read or -1 if end of ObjectInput.
+     * 
+     * @throws IOException
+     *             If the ObjectInput is already closed or another IOException
+     *             occurs.
+     */
+    public int read(byte[] buffer, int offset, int count) throws IOException;
+
+    /**
+     * Reads the next object from this ObjectInput.
+     * 
+     * @return the next object read from this ObjectInput
+     * 
+     * @throws IOException
+     *             If an error occurs attempting to read from this ObjectInput.
+     * @throws ClassNotFoundException
+     *             If the object's class cannot be found
+     */
+    public Object readObject() throws ClassNotFoundException, IOException;
+
+    /**
+     * Skips <code>toSkip</code> number of bytes in this ObjectInput.
+     * Subsequent <code>read()</code>'s will not return these bytes.
+     * 
+     * @param toSkip
+     *            the number of bytes to skip.
+     * @return the number of bytes actually skipped.
+     * 
+     * @throws IOException
+     *             If the ObjectInput is already closed or another IOException
+     *             occurs.
+     */
+    public long skip(long toSkip) throws IOException;
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java?view=diff&rev=492652&r1=492651&r2=492652
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java Thu Jan  4 09:47:01 2007
@@ -53,7 +53,7 @@
             new byte[0]);
 
     // To put into objectsRead when reading unsharedObject
-    private static final Object UNSHARED_OBJ = new Object();  //$NON-LOCK-1$
+    private static final Object UNSHARED_OBJ = new Object(); // $NON-LOCK-1$
 
     // If the receiver has already read & not consumed a TC code
     private boolean hasPushbackTC;
@@ -107,19 +107,19 @@
 
     // cache for readResolve methods
     private IdentityHashMap<Class<?>, Object> readResolveCache;
-    
-    private static final Hashtable<String, Class<?>> PRIMITIVE_CLASSES = new Hashtable<String,Class<?>>();
-    
+
+    private static final Hashtable<String, Class<?>> PRIMITIVE_CLASSES = new Hashtable<String, Class<?>>();
+
     static {
-		PRIMITIVE_CLASSES.put("byte", byte.class); //$NON-NLS-1$
-		PRIMITIVE_CLASSES.put("short", short.class); //$NON-NLS-1$
-		PRIMITIVE_CLASSES.put("int", int.class); //$NON-NLS-1$
-		PRIMITIVE_CLASSES.put("long", long.class); //$NON-NLS-1$
-		PRIMITIVE_CLASSES.put("boolean", boolean.class); //$NON-NLS-1$
-		PRIMITIVE_CLASSES.put("char", char.class); //$NON-NLS-1$
-		PRIMITIVE_CLASSES.put("float", float.class); //$NON-NLS-1$
-		PRIMITIVE_CLASSES.put("double", double.class); //$NON-NLS-1$
-	}
+        PRIMITIVE_CLASSES.put("byte", byte.class); //$NON-NLS-1$
+        PRIMITIVE_CLASSES.put("short", short.class); //$NON-NLS-1$
+        PRIMITIVE_CLASSES.put("int", int.class); //$NON-NLS-1$
+        PRIMITIVE_CLASSES.put("long", long.class); //$NON-NLS-1$
+        PRIMITIVE_CLASSES.put("boolean", boolean.class); //$NON-NLS-1$
+        PRIMITIVE_CLASSES.put("char", char.class); //$NON-NLS-1$
+        PRIMITIVE_CLASSES.put("float", float.class); //$NON-NLS-1$
+        PRIMITIVE_CLASSES.put("double", double.class); //$NON-NLS-1$
+    }
 
     // Internal type used to keep track of validators & corresponding priority
     static class InputValidationDesc {
@@ -585,19 +585,19 @@
      */
     @Override
     public int read(byte[] buffer, int offset, int length) throws IOException {
-        if (buffer != null) {
-            // avoid int overflow
-            if (0 <= offset && offset <= buffer.length && 0 <= length
-                    && length <= buffer.length - offset) {
-                if (length == 0) {
-                    return 0;
-                }
-                checkReadPrimitiveTypes();
-                return primitiveData.read(buffer, offset, length);
-            }
+        if (buffer == null) {
+            throw new NullPointerException();
+        }
+        // avoid int overflow
+        if (offset < 0 || offset > buffer.length || length < 0
+                || length > buffer.length - offset) {
             throw new ArrayIndexOutOfBoundsException();
         }
-        throw new NullPointerException();
+        if (length == 0) {
+            return 0;
+        }
+        checkReadPrimitiveTypes();
+        return primitiveData.read(buffer, offset, length);
     }
 
     /**
@@ -721,7 +721,7 @@
                 streamClass.setLoadFields(new ObjectStreamField[0]);
                 registerObjectRead(streamClass, Integer.valueOf(nextHandle()),
                         false);
-                checkedSetSuperClassDesc(streamClass, readClassDesc());                
+                checkedSetSuperClassDesc(streamClass, readClassDesc());
                 return streamClass;
             case TC_REFERENCE:
                 return (ObjectStreamClass) readCyclicReference();
@@ -957,20 +957,20 @@
             if (isPrimType) {
                 classSig = String.valueOf(typecode);
             } else {
-				// The spec says it is a UTF, but experience shows they dump
-				// this String using writeObject (unlike the field name, which
-				// is saved with writeUTF).
-                // And if resolveObject is enabled, the classSig may be modified 
-                // so that the original class descriptor cannot be read properly,
-                // so it is disabled.
-				boolean old = enableResolve;
-				try {
-					enableResolve = false;
-					classSig = (String) readObject();
-				} finally {
-					enableResolve = old;
-				}
-			}
+                // The spec says it is a UTF, but experience shows they dump
+                // this String using writeObject (unlike the field name, which
+                // is saved with writeUTF).
+                // And if resolveObject is enabled, the classSig may be modified
+                // so that the original class descriptor cannot be read
+                // properly, so it is disabled.
+                boolean old = enableResolve;
+                try {
+                    enableResolve = false;
+                    classSig = (String) readObject();
+                } finally {
+                    enableResolve = old;
+                }
+            }
             ObjectStreamField f = new ObjectStreamField(classSig, fieldName);
             fields[i] = f;
         }
@@ -995,13 +995,13 @@
     public GetField readFields() throws IOException, ClassNotFoundException,
             NotActiveException {
         // We can't be called from just anywhere. There are rules.
-        if (currentObject != null) {
-            EmulatedFieldsForLoading result = new EmulatedFieldsForLoading(
-                    currentClass);
-            readFieldValues(result);
-            return result;
+        if (currentObject == null) {
+            throw new NotActiveException();
         }
-        throw new NotActiveException();
+        EmulatedFieldsForLoading result = new EmulatedFieldsForLoading(
+                currentClass);
+        readFieldValues(result);
+        return result;
     }
 
     /**
@@ -1091,8 +1091,8 @@
     private void readFieldValues(Object obj, ObjectStreamClass classDesc)
             throws OptionalDataException, ClassNotFoundException, IOException {
         // Now we must read all fields and assign them to the receiver
-    	ObjectStreamField[] fields = classDesc.getLoadFields();
-    	fields = (null == fields ? new ObjectStreamField[] {} : fields);
+        ObjectStreamField[] fields = classDesc.getLoadFields();
+        fields = (null == fields ? new ObjectStreamField[] {} : fields);
         Class<?> declaringClass = classDesc.forClass();
         if (declaringClass == null && mustResolve) {
             throw new ClassNotFoundException(classDesc.getName());
@@ -1174,6 +1174,7 @@
                             objSetField(obj, declaringClass, fieldName, field
                                     .getTypeString(), toSet);
                         } catch (NoSuchFieldError e) {
+                            // Ignored
                         }
                     }
                 }
@@ -1577,19 +1578,20 @@
             ClassNotFoundException {
         byte tc = nextTC();
         switch (tc) {
-        case TC_CLASSDESC:
-            return readEnumDescInternal();            
-        case TC_REFERENCE:
-            return (ObjectStreamClass) readCyclicReference();
-        case TC_NULL:
-            return null;
-        default:
-            throw new StreamCorruptedException(Msg.getString(
-                    "K00d2", Integer.toHexString(tc & 0xff))); //$NON-NLS-1$
-        }        
+            case TC_CLASSDESC:
+                return readEnumDescInternal();
+            case TC_REFERENCE:
+                return (ObjectStreamClass) readCyclicReference();
+            case TC_NULL:
+                return null;
+            default:
+                throw new StreamCorruptedException(Msg.getString(
+                        "K00d2", Integer.toHexString(tc & 0xff))); //$NON-NLS-1$
+        }
     }
-    
-    private ObjectStreamClass readEnumDescInternal() throws IOException, ClassNotFoundException{
+
+    private ObjectStreamClass readEnumDescInternal() throws IOException,
+            ClassNotFoundException {
         ObjectStreamClass classDesc;
         primitiveData = input;
         Integer oldHandle = descriptorHandle;
@@ -1604,7 +1606,7 @@
         // Consume unread class annotation data and TC_ENDBLOCKDATA
         discardData();
         ObjectStreamClass superClass = readClassDesc();
-        checkedSetSuperClassDesc(classDesc, superClass);         
+        checkedSetSuperClassDesc(classDesc, superClass);
         // Check SUIDs, note all SUID for Enum is 0L
         if (0L != classDesc.getSerialVersionUID()
                 || 0L != superClass.getSerialVersionUID()) {
@@ -1623,8 +1625,8 @@
         }
         return classDesc;
     }
-    
-    @SuppressWarnings("unchecked") //For the Enum.valueOf call
+
+    @SuppressWarnings("unchecked")// For the Enum.valueOf call
     private Object readEnum(boolean unshared) throws OptionalDataException,
             ClassNotFoundException, IOException {
         // read classdesc for Enum first
@@ -1689,7 +1691,7 @@
             // Check SUIDs
             verifySUID(newClassDesc);
             // Check base name of the class
-            verifyBaseName(newClassDesc);           
+            verifyBaseName(newClassDesc);
         } catch (ClassNotFoundException e) {
             if (mustResolve) {
                 throw e;
@@ -1709,7 +1711,7 @@
 
         // Consume unread class annotation data and TC_ENDBLOCKDATA
         discardData();
-        checkedSetSuperClassDesc(newClassDesc, readClassDesc());      
+        checkedSetSuperClassDesc(newClassDesc, readClassDesc());
         return newClassDesc;
     }
 
@@ -1761,8 +1763,9 @@
 
         // We must register the class descriptor before reading field
         // descriptors.
-        //if called outside of readObject, the descriptorHandle might be null
-        descriptorHandle = (null == descriptorHandle? Integer.valueOf(nextHandle()):descriptorHandle);
+        // if called outside of readObject, the descriptorHandle might be null
+        descriptorHandle = (null == descriptorHandle ? Integer
+                .valueOf(nextHandle()) : descriptorHandle);
         registerObjectRead(newClassDesc, descriptorHandle, false);
         descriptorHandle = null;
 
@@ -1978,7 +1981,8 @@
                 }
                 if (readResolveMethod != null) {
                     try {
-                        result = ((Method) readResolveMethod).invoke(result, (Object[]) null);
+                        result = ((Method) readResolveMethod).invoke(result,
+                                (Object[]) null);
                     } catch (IllegalAccessException iae) {
                     } catch (InvocationTargetException ite) {
                         Throwable target = ite.getTargetException();
@@ -2171,7 +2175,7 @@
     protected Object readObjectOverride() throws OptionalDataException,
             ClassNotFoundException, IOException {
         if (input == null) {
-        	return null;
+            return null;
         }
         // Subclasses must override.
         throw new IOException();
@@ -2339,7 +2343,8 @@
             int currentSize = oldValidations.length;
             validations = new InputValidationDesc[currentSize + 1];
             System.arraycopy(oldValidations, 0, validations, 0, i);
-            System.arraycopy(oldValidations, i, validations, i + 1, currentSize - i);
+            System.arraycopy(oldValidations, i, validations, i + 1, currentSize
+                    - i);
             validations[i] = desc;
         }
     }
@@ -2379,18 +2384,18 @@
      *             If the corresponding class cannot be found.
      */
     protected Class<?> resolveClass(ObjectStreamClass osClass)
-			throws IOException, ClassNotFoundException {		
-		String className = osClass.getName();
-		//if it is primitive class, for example, long.class
-		Class<?> cls = PRIMITIVE_CLASSES.get(className);
-		if (null == cls) {
-			//not primitive class
-            //Use the first non-null ClassLoader on the stack. If null, use the
-			// system class loader
-			return Class.forName(className, true, callerClassLoader);
-		}
-		return cls;
-	}
+            throws IOException, ClassNotFoundException {
+        String className = osClass.getName();
+        // if it is primitive class, for example, long.class
+        Class<?> cls = PRIMITIVE_CLASSES.get(className);
+        if (null == cls) {
+            // not primitive class
+            // Use the first non-null ClassLoader on the stack. If null, use the
+            // system class loader
+            return Class.forName(className, true, callerClassLoader);
+        }
+        return cls;
+    }
 
     /**
      * If <code>enableResolveObject()</code> was activated, computes the
@@ -2725,7 +2730,8 @@
      *            An ObjectStreamClass that was loaded from the stream.
      * 
      * @throws InvalidClassException
-     *          If the base name of the stream class does not match the VM class
+     *             If the base name of the stream class does not match the VM
+     *             class
      */
     private void verifyBaseName(ObjectStreamClass loadedStreamClass)
             throws InvalidClassException {
@@ -2748,15 +2754,15 @@
         if (k == -1 || k == (fullName.length() - 1)) {
             return fullName;
         }
-        return fullName.substring(k + 1);        
+        return fullName.substring(k + 1);
     }
-    
-    //Avoid recursive defining.
+
+    // Avoid recursive defining.
     private static void checkedSetSuperClassDesc(ObjectStreamClass desc,
-			ObjectStreamClass superDesc) throws StreamCorruptedException {
-		if (desc.equals(superDesc)) {
-			throw new StreamCorruptedException();
-		}
-		desc.setSuperclass(superDesc);
-	}
+            ObjectStreamClass superDesc) throws StreamCorruptedException {
+        if (desc.equals(superDesc)) {
+            throw new StreamCorruptedException();
+        }
+        desc.setSuperclass(superDesc);
+    }
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputValidation.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputValidation.java?view=diff&rev=492652&r1=492651&r2=492652
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputValidation.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputValidation.java Thu Jan  4 09:47:01 2007
@@ -15,8 +15,7 @@
  *  limitations under the License.
  */
 
-package java.io; 
-
+package java.io;
 
 /**
  * Objects to perform validations on other objects read with serialization
@@ -27,11 +26,11 @@
  * @see ObjectInputStream
  */
 public interface ObjectInputValidation {
-	/**
-	 * Validates an object read with serialization.
-	 * 
-	 * @throws InvalidObjectException
-	 *             if the receiver fails to validate the object read
-	 */
-	public void validateObject() throws InvalidObjectException;
+    /**
+     * Validates an object read with serialization.
+     * 
+     * @throws InvalidObjectException
+     *             if the receiver fails to validate the object read
+     */
+    public void validateObject() throws InvalidObjectException;
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectOutput.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectOutput.java?view=diff&rev=492652&r1=492651&r2=492652
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectOutput.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectOutput.java Thu Jan  4 09:47:01 2007
@@ -15,8 +15,7 @@
  *  limitations under the License.
  */
 
-package java.io; 
-
+package java.io;
 
 /**
  * Streams to be used with serialization to write objects must implement this
@@ -26,72 +25,72 @@
  * @see ObjectInput
  */
 public interface ObjectOutput extends DataOutput {
-	/**
-	 * Close this ObjectOutput. Concrete implementations of this class should
-	 * free any resources during close.
-	 * 
-	 * @throws IOException
-	 *             If an error occurs attempting to close this ObjectOutput.
-	 */
-	public void close() throws IOException;
-
-	/**
-	 * Flush this ObjectOutput. Concrete implementations of this class should
-	 * ensure any pending writes are written out when this method is envoked.
-	 * 
-	 * @throws IOException
-	 *             If an error occurs attempting to flush this ObjectOutput.
-	 */
-	public void flush() throws IOException;
-
-	/**
-	 * Writes the entire contents of the byte array <code>buffer</code> to
-	 * this ObjectOutput.
-	 * 
-	 * @param buffer
-	 *            the buffer to be written
-	 * 
-	 * @throws java.io.IOException
-	 *             If an error occurs attempting to write to this ObjectOutput.
-	 */
-	public void write(byte[] buffer) throws IOException;
-
-	/**
-	 * Writes <code>count</code> <code>bytes</code> from this byte array
-	 * <code>buffer</code> starting at offset <code>index</code> to this
-	 * ObjectOutput.
-	 * 
-	 * @param buffer
-	 *            the buffer to be written
-	 * @param offset
-	 *            offset in buffer to get bytes
-	 * @param count
-	 *            number of bytes in buffer to write
-	 * 
-	 * @throws java.io.IOException
-	 *             If an error occurs attempting to write to this ObjectOutput.
-	 */
-	public void write(byte[] buffer, int offset, int count) throws IOException;
-
-	/**
-	 * Writes the specified int <code>value</code> to this ObjectOutput.
-	 * 
-	 * @param value
-	 *            the int to be written
-	 * 
-	 * @throws java.io.IOException
-	 *             If an error occurs attempting to write to this ObjectOutput.
-	 */
-	public void write(int value) throws IOException;
-
-	/**
-	 * Writes the specified object <code>obj</code> to this ObjectOutput.
-	 * 
-	 * @param obj
-	 *            the object to be written
-	 * 
-	 * @throws java.io.IOException
-	 *             If an error occurs attempting to write to this ObjectOutput.
-	 */
-	public void writeObject(Object obj) throws IOException;
+    /**
+     * Close this ObjectOutput. Concrete implementations of this class should
+     * free any resources during close.
+     * 
+     * @throws IOException
+     *             If an error occurs attempting to close this ObjectOutput.
+     */
+    public void close() throws IOException;
+
+    /**
+     * Flush this ObjectOutput. Concrete implementations of this class should
+     * ensure any pending writes are written out when this method is envoked.
+     * 
+     * @throws IOException
+     *             If an error occurs attempting to flush this ObjectOutput.
+     */
+    public void flush() throws IOException;
+
+    /**
+     * Writes the entire contents of the byte array <code>buffer</code> to
+     * this ObjectOutput.
+     * 
+     * @param buffer
+     *            the buffer to be written
+     * 
+     * @throws java.io.IOException
+     *             If an error occurs attempting to write to this ObjectOutput.
+     */
+    public void write(byte[] buffer) throws IOException;
+
+    /**
+     * Writes <code>count</code> <code>bytes</code> from this byte array
+     * <code>buffer</code> starting at offset <code>index</code> to this
+     * ObjectOutput.
+     * 
+     * @param buffer
+     *            the buffer to be written
+     * @param offset
+     *            offset in buffer to get bytes
+     * @param count
+     *            number of bytes in buffer to write
+     * 
+     * @throws java.io.IOException
+     *             If an error occurs attempting to write to this ObjectOutput.
+     */
+    public void write(byte[] buffer, int offset, int count) throws IOException;
+
+    /**
+     * Writes the specified int <code>value</code> to this ObjectOutput.
+     * 
+     * @param value
+     *            the int to be written
+     * 
+     * @throws java.io.IOException
+     *             If an error occurs attempting to write to this ObjectOutput.
+     */
+    public void write(int value) throws IOException;
+
+    /**
+     * Writes the specified object <code>obj</code> to this ObjectOutput.
+     * 
+     * @param obj
+     *            the object to be written
+     * 
+     * @throws java.io.IOException
+     *             If an error occurs attempting to write to this ObjectOutput.
+     */
+    public void writeObject(Object obj) throws IOException;
 }



Mime
View raw message