harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r432462 [9/21] - /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/
Date Fri, 18 Aug 2006 01:45:39 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberInputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberInputStream.java?rev=432462&r1=432461&r2=432462&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberInputStream.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberInputStream.java Thu Aug 17 18:45:35 2006
@@ -1,231 +1,231 @@
-/* Copyright 1998, 2004 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package java.io; 
-
-
-/**
- * LineNumberInputStream is a filter class which counts the number of line
- * terminators from the data read from the target InputStream. A line delimeter
- * sequence is determined by '\r', '\n', or '\r\n'. When using <code>read</code>,
- * the sequence is always translated into '\n'.
- * 
- * @deprecated Use LineNumberReader
- */
-public class LineNumberInputStream extends FilterInputStream {
-	private int lineNumber = 0;
-
-	private int markedLineNumber = -1;
-
-	private int lastChar = -1, 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.
-	 */
-	public int available() throws IOException {
-		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.
-	 */
-	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 delimeter 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.
-	 */
-	public int read() throws IOException {
-		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;
-		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 delimeter 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.
-	 */
-	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.
-	 */
-	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.
-	 */
-	public long skip(long count) throws IOException {
-		if (count <= 0)
-			return 0;
-		for (int i = 0; i < count; i++) {
-			int currentChar = read();
-			if (currentChar == -1)
-				return i;
-		}
-		return count;
-	}
-
-}
+/* Copyright 1998, 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.io; 
+
+
+/**
+ * LineNumberInputStream is a filter class which counts the number of line
+ * terminators from the data read from the target InputStream. A line delimeter
+ * sequence is determined by '\r', '\n', or '\r\n'. When using <code>read</code>,
+ * the sequence is always translated into '\n'.
+ * 
+ * @deprecated Use LineNumberReader
+ */
+public class LineNumberInputStream extends FilterInputStream {
+	private int lineNumber = 0;
+
+	private int markedLineNumber = -1;
+
+	private int lastChar = -1, 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.
+	 */
+	public int available() throws IOException {
+		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.
+	 */
+	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 delimeter 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.
+	 */
+	public int read() throws IOException {
+		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;
+		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 delimeter 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.
+	 */
+	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.
+	 */
+	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.
+	 */
+	public long skip(long count) throws IOException {
+		if (count <= 0)
+			return 0;
+		for (int i = 0; i < count; i++) {
+			int currentChar = read();
+			if (currentChar == -1)
+				return i;
+		}
+		return count;
+	}
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberInputStream.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberReader.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberReader.java?rev=432462&r1=432461&r2=432462&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberReader.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberReader.java Thu Aug 17 18:45:35 2006
@@ -1,259 +1,259 @@
-/* Copyright 1998, 2004 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package java.io; 
-
-
-/**
- * LineNumberReader is a buffered character input reader which counts line
- * numbers as data is being read. The line number starts at 0 and is incremented
- * any time '\r', '\n', or '\r\n' is read.
- * 
- * @see BufferedWriter
- */
-public class LineNumberReader extends BufferedReader {
-	private int lineNumber = 0;
-
-	private int markedLineNumber = -1;
-
-	private boolean lastWasCR = false, 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.
-	 */
-	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 delimeter 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.
-	 */
-	public int read() throws IOException {
-		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 delimeter 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.
-	 */
-
-	public int read(char[] buffer, int offset, int count) throws IOException {
-		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)
-						lineNumber++;
-					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.
-	 */
-	public String readLine() throws IOException {
-		synchronized (lock) {
-			/* Typical Line Length */
-            StringBuilder result = new StringBuilder(80);
-			while (true) {
-				int character = read();
-				if (character == -1)
-					return result.length() != 0 ? result.toString() : null;
-				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.
-	 */
-	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.
-	 */
-	public long skip(long count) throws IOException {
-		if (count >= 0) {
-			synchronized (lock) {
-				for (int i = 0; i < count; i++)
-					if (read() == -1)
-						return i;
-				return count;
-			}
-		}
-		throw new IllegalArgumentException();
-	}
-}
+/* Copyright 1998, 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.io; 
+
+
+/**
+ * LineNumberReader is a buffered character input reader which counts line
+ * numbers as data is being read. The line number starts at 0 and is incremented
+ * any time '\r', '\n', or '\r\n' is read.
+ * 
+ * @see BufferedWriter
+ */
+public class LineNumberReader extends BufferedReader {
+	private int lineNumber = 0;
+
+	private int markedLineNumber = -1;
+
+	private boolean lastWasCR = false, 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.
+	 */
+	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 delimeter 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.
+	 */
+	public int read() throws IOException {
+		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 delimeter 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.
+	 */
+
+	public int read(char[] buffer, int offset, int count) throws IOException {
+		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)
+						lineNumber++;
+					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.
+	 */
+	public String readLine() throws IOException {
+		synchronized (lock) {
+			/* Typical Line Length */
+            StringBuilder result = new StringBuilder(80);
+			while (true) {
+				int character = read();
+				if (character == -1)
+					return result.length() != 0 ? result.toString() : null;
+				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.
+	 */
+	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.
+	 */
+	public long skip(long count) throws IOException {
+		if (count >= 0) {
+			synchronized (lock) {
+				for (int i = 0; i < count; i++)
+					if (read() == -1)
+						return i;
+				return count;
+			}
+		}
+		throw new IllegalArgumentException();
+	}
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/LineNumberReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/NotActiveException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/NotActiveException.java?rev=432462&r1=432461&r2=432462&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/NotActiveException.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/NotActiveException.java Thu Aug 17 18:45:35 2006
@@ -1,56 +1,56 @@
-/* Copyright 1998, 2004 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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
- * from another context will cause this exception to be thrown. The list of
- * methods that are protected this way is:
- * <ul>
- * <li>ObjectInputStream.defaultReadObject()</li>
- * <li>ObjectInputStream.registerValidation()</li>
- * <li>ObjectOutputStream.defaultWriteObject()</li>
- * </ul>
- * 
- * @see ObjectInputStream#defaultReadObject()
- * @see ObjectInputStream#registerValidation(ObjectInputValidation, int)
- * @see ObjectOutputStream#defaultWriteObject()
- */
-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();
-	}
-
-	/**
-	 * 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);
-	}
-
-}
+/* Copyright 1998, 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+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
+ * from another context will cause this exception to be thrown. The list of
+ * methods that are protected this way is:
+ * <ul>
+ * <li>ObjectInputStream.defaultReadObject()</li>
+ * <li>ObjectInputStream.registerValidation()</li>
+ * <li>ObjectOutputStream.defaultWriteObject()</li>
+ * </ul>
+ * 
+ * @see ObjectInputStream#defaultReadObject()
+ * @see ObjectInputStream#registerValidation(ObjectInputValidation, int)
+ * @see ObjectOutputStream#defaultWriteObject()
+ */
+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();
+	}
+
+	/**
+	 * 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);
+	}
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/NotActiveException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/NotSerializableException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/NotSerializableException.java?rev=432462&r1=432461&r2=432462&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/NotSerializableException.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/NotSerializableException.java Thu Aug 17 18:45:35 2006
@@ -1,53 +1,53 @@
-/* Copyright 1998, 2004 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-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
- * the object does not implement Serializable or Externalizable, or if it is
- * Serializable but it overrides writeObject(ObjectOutputStream) and explicitely
- * decides it wants to prevent serialization, by throwing this type of
- * exception.
- * 
- * @see ObjectOutputStream#writeObject(Object)
- * @see ObjectOutput#writeObject(Object)
- */
-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();
-	}
-
-	/**
-	 * 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);
-	}
-
-}
+/* Copyright 1998, 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+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
+ * the object does not implement Serializable or Externalizable, or if it is
+ * Serializable but it overrides writeObject(ObjectOutputStream) and explicitely
+ * decides it wants to prevent serialization, by throwing this type of
+ * exception.
+ * 
+ * @see ObjectOutputStream#writeObject(Object)
+ * @see ObjectOutput#writeObject(Object)
+ */
+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();
+	}
+
+	/**
+	 * 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);
+	}
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/NotSerializableException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInput.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInput.java?rev=432462&r1=432461&r2=432462&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInput.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInput.java Thu Aug 17 18:45:35 2006
@@ -1,120 +1,120 @@
-/* Copyright 1998, 2004 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package java.io; 
-
-
-/**
- * Streams to be used with serialization to read objects must implement this
- * interface. ObjectInputStream is one example.
- * 
- * @see ObjectInputStream
- * @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;
-}
+/* Copyright 1998, 2004 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.io; 
+
+
+/**
+ * Streams to be used with serialization to read objects must implement this
+ * interface. ObjectInputStream is one example.
+ * 
+ * @see ObjectInputStream
+ * @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;
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInput.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message