harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r432462 [2/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/DataInput.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/DataInput.java?rev=432462&r1=432461&r2=432462&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/DataInput.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/DataInput.java Thu Aug 17 18:45:35 2006
@@ -1,230 +1,230 @@
-/* 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;
-
-
-/**
- * DataInput is an interface which declares methods for reading in typed data
- * from a Stream. Typically, this stream has been written by a class which
- * implements DataOutput. Types that can be read include byte, 16-bit short,
- * 32-bit int, 32-bit float, 64-bit long, 64-bit double, byte strings, and UTF
- * Strings.
- * 
- * @see DataInputStream
- * @see RandomAccessFile
- */
-public interface DataInput {
-	/**
-	 * Reads a boolean from this stream.
-	 * 
-	 * @return the next boolean value from the source stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this stream.
-	 * 
-	 * @see DataOutput#writeBoolean(boolean)
-	 */
-	public abstract boolean readBoolean() throws IOException;
-
-	/**
-	 * Reads an 8-bit byte value from this stream.
-	 * 
-	 * @return the next byte value from the source stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this stream.
-	 * 
-	 * @see DataOutput#writeByte(int)
-	 */
-	public abstract byte readByte() throws IOException;
-
-	/**
-	 * Reads a 16-bit character value from this stream.
-	 * 
-	 * @return the next <code>char</code> value from the source stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this stream.
-	 * 
-	 * @see DataOutput#writeChar(int)
-	 */
-	public abstract char readChar() throws IOException;
-
-	/**
-	 * Reads a 64-bit <code>double</code> value from this stream.
-	 * 
-	 * @return the next <code>double</code> value from the source stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this stream.
-	 * 
-	 * @see DataOutput#writeDouble(double)
-	 */
-	public abstract double readDouble() throws IOException;
-
-	/**
-	 * Reads a 32-bit <code>float</code> value from this stream.
-	 * 
-	 * @return the next <code>float</code> value from the source stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this stream.
-	 * 
-	 * @see DataOutput#writeFloat(float)
-	 */
-	public abstract float readFloat() throws IOException;
-
-	/**
-	 * Reads bytes from this stream into the byte array <code>buffer</code>.
-	 * This method will block until <code>buffer.length</code> number of bytes
-	 * have been read.
-	 * 
-	 * @param buffer
-	 *            the buffer to read bytes into
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this stream.
-	 * 
-	 * @see DataOutput#write(byte[])
-	 * @see DataOutput#write(byte[], int, int)
-	 */
-	public abstract void readFully(byte[] buffer) throws IOException;
-
-	/**
-	 * Read bytes from this stream and stores them in byte array
-	 * <code>buffer</code> starting at offset <code>offset</code>. This
-	 * method blocks until <code>count</code> number of bytes have been read.
-	 * 
-	 * @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>.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this stream.
-	 * 
-	 * @see DataOutput#write(byte[])
-	 * @see DataOutput#write(byte[], int, int)
-	 */
-	public abstract void readFully(byte[] buffer, int offset, int count)
-			throws IOException;
-
-	/**
-	 * Reads a 32-bit integer value from this stream.
-	 * 
-	 * @return the next <code>int</code> value from the source stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this stream.
-	 * 
-	 * @see DataOutput#writeInt(int)
-	 */
-	public abstract int readInt() throws IOException;
-
-	/**
-	 * Answers a <code>String</code> representing the next line of text
-	 * available in this BufferedReader. 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 the contents of the line or null if no characters were read
-	 *         before end of stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this stream.
-	 */
-	public abstract String readLine() throws IOException;
-
-	/**
-	 * Reads a 64-bit <code>long</code> value from this stream.
-	 * 
-	 * @return the next <code>long</code> value from the source stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this stream.
-	 * 
-	 * @see DataOutput#writeLong(long)
-	 */
-	public abstract long readLong() throws IOException;
-
-	/**
-	 * Reads a 16-bit <code>short</code> value from this stream.
-	 * 
-	 * @return the next <code>short</code> value from the source stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this stream.
-	 * 
-	 * @see DataOutput#writeShort(int)
-	 */
-	public abstract short readShort() throws IOException;
-
-	/**
-	 * Reads an unsigned 8-bit <code>byte</code> value from this stream and
-	 * returns it as an int.
-	 * 
-	 * @return the next unsigned byte value from the source stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this stream.
-	 * 
-	 * @see DataOutput#writeByte(int)
-	 */
-	public abstract int readUnsignedByte() throws IOException;
-
-	/**
-	 * Reads a 16-bit unsigned <code>short</code> value from this stream and
-	 * returns it as an int.
-	 * 
-	 * @return the next unsigned <code>short</code> value from the source
-	 *         stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this stream.
-	 * 
-	 * @see DataOutput#writeShort(int)
-	 */
-	public abstract int readUnsignedShort() throws IOException;
-
-	/**
-	 * Reads a UTF format String from this Stream.
-	 * 
-     * @return the next UTF String from the source stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this stream.
-	 * 
-	 * @see DataOutput#writeUTF(java.lang.String)
-	 */
-	public abstract String readUTF() throws IOException;
-
-	/**
-	 * Skips <code>count</code> number of bytes in this stream. Subsequent
-	 * <code>read()</code>'s will not return these bytes unless
-	 * <code>reset()</code> is used.
-	 * 
-	 * @param count
-	 *            the number of bytes to skip.
-	 * @return the number of bytes actually skipped.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this stream.
-	 */
-	public abstract int skipBytes(int count) 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;
+
+
+/**
+ * DataInput is an interface which declares methods for reading in typed data
+ * from a Stream. Typically, this stream has been written by a class which
+ * implements DataOutput. Types that can be read include byte, 16-bit short,
+ * 32-bit int, 32-bit float, 64-bit long, 64-bit double, byte strings, and UTF
+ * Strings.
+ * 
+ * @see DataInputStream
+ * @see RandomAccessFile
+ */
+public interface DataInput {
+	/**
+	 * Reads a boolean from this stream.
+	 * 
+	 * @return the next boolean value from the source stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this stream.
+	 * 
+	 * @see DataOutput#writeBoolean(boolean)
+	 */
+	public abstract boolean readBoolean() throws IOException;
+
+	/**
+	 * Reads an 8-bit byte value from this stream.
+	 * 
+	 * @return the next byte value from the source stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this stream.
+	 * 
+	 * @see DataOutput#writeByte(int)
+	 */
+	public abstract byte readByte() throws IOException;
+
+	/**
+	 * Reads a 16-bit character value from this stream.
+	 * 
+	 * @return the next <code>char</code> value from the source stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this stream.
+	 * 
+	 * @see DataOutput#writeChar(int)
+	 */
+	public abstract char readChar() throws IOException;
+
+	/**
+	 * Reads a 64-bit <code>double</code> value from this stream.
+	 * 
+	 * @return the next <code>double</code> value from the source stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this stream.
+	 * 
+	 * @see DataOutput#writeDouble(double)
+	 */
+	public abstract double readDouble() throws IOException;
+
+	/**
+	 * Reads a 32-bit <code>float</code> value from this stream.
+	 * 
+	 * @return the next <code>float</code> value from the source stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this stream.
+	 * 
+	 * @see DataOutput#writeFloat(float)
+	 */
+	public abstract float readFloat() throws IOException;
+
+	/**
+	 * Reads bytes from this stream into the byte array <code>buffer</code>.
+	 * This method will block until <code>buffer.length</code> number of bytes
+	 * have been read.
+	 * 
+	 * @param buffer
+	 *            the buffer to read bytes into
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this stream.
+	 * 
+	 * @see DataOutput#write(byte[])
+	 * @see DataOutput#write(byte[], int, int)
+	 */
+	public abstract void readFully(byte[] buffer) throws IOException;
+
+	/**
+	 * Read bytes from this stream and stores them in byte array
+	 * <code>buffer</code> starting at offset <code>offset</code>. This
+	 * method blocks until <code>count</code> number of bytes have been read.
+	 * 
+	 * @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>.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this stream.
+	 * 
+	 * @see DataOutput#write(byte[])
+	 * @see DataOutput#write(byte[], int, int)
+	 */
+	public abstract void readFully(byte[] buffer, int offset, int count)
+			throws IOException;
+
+	/**
+	 * Reads a 32-bit integer value from this stream.
+	 * 
+	 * @return the next <code>int</code> value from the source stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this stream.
+	 * 
+	 * @see DataOutput#writeInt(int)
+	 */
+	public abstract int readInt() throws IOException;
+
+	/**
+	 * Answers a <code>String</code> representing the next line of text
+	 * available in this BufferedReader. 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 the contents of the line or null if no characters were read
+	 *         before end of stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this stream.
+	 */
+	public abstract String readLine() throws IOException;
+
+	/**
+	 * Reads a 64-bit <code>long</code> value from this stream.
+	 * 
+	 * @return the next <code>long</code> value from the source stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this stream.
+	 * 
+	 * @see DataOutput#writeLong(long)
+	 */
+	public abstract long readLong() throws IOException;
+
+	/**
+	 * Reads a 16-bit <code>short</code> value from this stream.
+	 * 
+	 * @return the next <code>short</code> value from the source stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this stream.
+	 * 
+	 * @see DataOutput#writeShort(int)
+	 */
+	public abstract short readShort() throws IOException;
+
+	/**
+	 * Reads an unsigned 8-bit <code>byte</code> value from this stream and
+	 * returns it as an int.
+	 * 
+	 * @return the next unsigned byte value from the source stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this stream.
+	 * 
+	 * @see DataOutput#writeByte(int)
+	 */
+	public abstract int readUnsignedByte() throws IOException;
+
+	/**
+	 * Reads a 16-bit unsigned <code>short</code> value from this stream and
+	 * returns it as an int.
+	 * 
+	 * @return the next unsigned <code>short</code> value from the source
+	 *         stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this stream.
+	 * 
+	 * @see DataOutput#writeShort(int)
+	 */
+	public abstract int readUnsignedShort() throws IOException;
+
+	/**
+	 * Reads a UTF format String from this Stream.
+	 * 
+     * @return the next UTF String from the source stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this stream.
+	 * 
+	 * @see DataOutput#writeUTF(java.lang.String)
+	 */
+	public abstract String readUTF() throws IOException;
+
+	/**
+	 * Skips <code>count</code> number of bytes in this stream. Subsequent
+	 * <code>read()</code>'s will not return these bytes unless
+	 * <code>reset()</code> is used.
+	 * 
+	 * @param count
+	 *            the number of bytes to skip.
+	 * @return the number of bytes actually skipped.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this stream.
+	 */
+	public abstract int skipBytes(int count) throws IOException;
+}

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/DataInputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/DataInputStream.java?rev=432462&r1=432461&r2=432462&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/DataInputStream.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/DataInputStream.java Thu Aug 17 18:45:35 2006
@@ -1,471 +1,471 @@
-/* Copyright 1998, 2005 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;
-
-
-/**
- * DataInputStream is a filter class which can read typed data from a Stream.
- * Typically, this stream has been written by a DataOutputStream. Types that can
- * be read include byte, 16-bit short, 32-bit int, 32-bit float, 64-bit long,
- * 64-bit double, byte strings, and UTF Strings.
- * 
- * @see DataOutputStream
- */
-public class DataInputStream extends FilterInputStream implements DataInput {
-	/**
-	 * Constructs a new DataInputStream on the InputStream <code>in</code>.
-	 * All reads can now be filtered through this stream. Note that data read by
-	 * this Stream is not in a human readable format and was most likely created
-	 * by a DataOutputStream.
-	 * 
-	 * @param in
-	 *            the target InputStream to filter reads on.
-	 * 
-	 * @see DataOutputStream
-	 * @see RandomAccessFile
-	 */
-	public DataInputStream(InputStream in) {
-		super(in);
-	}
-
-	/**
-	 * Reads bytes from the source stream into the byte array
-	 * <code>buffer</code>. The number of bytes actually read is returned.
-	 * 
-	 * @param buffer
-	 *            the buffer to read bytes into
-	 * @return the number of bytes actually read or -1 if end of stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this DataInputStream.
-	 * 
-	 * @see DataOutput#write(byte[])
-	 * @see DataOutput#write(byte[], int, int)
-	 */
-	public final int read(byte[] buffer) throws IOException {
-		return in.read(buffer, 0, buffer.length);
-	}
-
-	/**
-	 * Read at most <code>length</code> bytes from this DataInputStream 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.
-	 * 
-	 * @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 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 a problem occurs reading from this DataInputStream.
-	 * 
-	 * @see DataOutput#write(byte[])
-	 * @see DataOutput#write(byte[], int, int)
-	 */
-	public final int read(byte[] buffer, int offset, int length)
-			throws IOException {
-		return in.read(buffer, offset, length);
-	}
-
-	/**
-	 * Reads a boolean from this stream.
-	 * 
-	 * @return the next boolean value from the source stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this DataInputStream.
-	 * 
-	 * @see DataOutput#writeBoolean(boolean)
-	 */
-	public final boolean readBoolean() throws IOException {
-		int temp = in.read();
-		if (temp >= 0)
-			return temp != 0;
-		throw new EOFException();
-	}
-
-	/**
-	 * Reads an 8-bit byte value from this stream.
-	 * 
-	 * @return the next byte value from the source stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this DataInputStream.
-	 * 
-	 * @see DataOutput#writeByte(int)
-	 */
-	public final byte readByte() throws IOException {
-		int temp = in.read();
-		if (temp >= 0)
-			return (byte) temp;
-		throw new EOFException();
-	}
-
-	/**
-	 * Reads a 16-bit character value from this stream.
-	 * 
-	 * @return the next <code>char</code> value from the source stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this DataInputStream.
-	 * 
-	 * @see DataOutput#writeChar(int)
-	 */
-	public final char readChar() throws IOException {
-		int b1 = in.read();
-		int b2 = in.read();
-		if ((b1 | b2) >= 0)
-			return (char) ((b1 << 8) + b2);
-		throw new EOFException();
-	}
-
-	/**
-	 * Reads a 64-bit <code>double</code> value from this stream.
-	 * 
-	 * @return the next <code>double</code> value from the source stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this DataInputStream.
-	 * 
-	 * @see DataOutput#writeDouble(double)
-	 */
-	public final double readDouble() throws IOException {
-		return Double.longBitsToDouble(readLong());
-	}
-
-	/**
-	 * Reads a 32-bit <code>float</code> value from this stream.
-	 * 
-	 * @return the next <code>float</code> value from the source stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this DataInputStream.
-	 * 
-	 * @see DataOutput#writeFloat(float)
-	 */
-	public final float readFloat() throws IOException {
-		return Float.intBitsToFloat(readInt());
-	}
-
-	/**
-	 * Reads bytes from this stream into the byte array <code>buffer</code>.
-	 * This method will block until <code>buffer.length</code> number of bytes
-	 * have been read.
-	 * 
-	 * @param buffer
-	 *            to read bytes into
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this DataInputStream.
-	 * 
-	 * @see DataOutput#write(byte[])
-	 * @see DataOutput#write(byte[], int, int)
-	 */
-	public final void readFully(byte[] buffer) throws IOException {
-		readFully(buffer, 0, buffer.length);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.io.DataInput#readFully(byte[], int, int)
-	 */
-	public final void readFully(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) {
-				while (length > 0) {
-					int result = in.read(buffer, offset, length);
-					if (result >= 0) {
-						offset += result;
-						length -= result;
-					} else
-						throw new EOFException();
-				}
-			} else
-				throw new IndexOutOfBoundsException();
-		} else
-			throw new NullPointerException(org.apache.harmony.luni.util.Msg
-					.getString("K0047")); //$NON-NLS-1$
-	}
-
-	/**
-	 * Reads a 32-bit integer value from this stream.
-	 * 
-	 * @return the next <code>int</code> value from the source stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this DataInputStream.
-	 * 
-	 * @see DataOutput#writeInt(int)
-	 */
-	public final int readInt() throws IOException {
-		int b1 = in.read();
-		int b2 = in.read();
-		int b3 = in.read();
-		int b4 = in.read();
-		if ((b1 | b2 | b3 | b4) >= 0)
-			return ((b1 << 24) + (b2 << 16) + (b3 << 8) + b4);
-		throw new EOFException();
-	}
-
-	/**
-	 * Answers a <code>String</code> representing the next line of text
-	 * available in this BufferedReader. 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 the contents of the line or null if no characters were read
-	 *         before end of stream.
-	 * 
-	 * @throws IOException
-	 *             If the DataInputStream is already closed or some other IO
-	 *             error occurs.
-	 * 
-	 * @deprecated Use BufferedReader
-	 */
-	public final String readLine() throws IOException {
-		StringBuffer line = new StringBuffer(80); // Typical line length
-		boolean foundTerminator = false;
-		while (true) {
-			int nextByte = in.read();
-			switch (nextByte) {
-			case -1:
-				if (line.length() == 0 && !foundTerminator)
-					return null;
-				return line.toString();
-			case (byte) '\r':
-				if (foundTerminator) {
-					((PushbackInputStream) in).unread(nextByte);
-					return line.toString();
-				}
-				foundTerminator = true;
-				/* Have to be able to peek ahead one byte */
-				if (!(in.getClass() == PushbackInputStream.class))
-					in = new PushbackInputStream(in);
-				break;
-			case (byte) '\n':
-				return line.toString();
-			default:
-				if (foundTerminator) {
-					((PushbackInputStream) in).unread(nextByte);
-					return line.toString();
-				}
-				line.append((char) nextByte);
-			}
-		}
-	}
-
-	/**
-	 * Reads a 64-bit <code>long</code> value from this stream.
-	 * 
-	 * @return the next <code>long</code> value from the source stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this DataInputStream.
-	 * 
-	 * @see DataOutput#writeLong(long)
-	 */
-	public final long readLong() throws IOException {
-		int i1 = readInt();
-		int b1 = in.read();
-		int b2 = in.read();
-		int b3 = in.read();
-		int b4 = in.read();
-		if ((b1 | b2 | b3 | b4) >= 0)
-			return (((long) i1) << 32) + ((long) b1 << 24) + (b2 << 16)
-					+ (b3 << 8) + b4;
-		throw new EOFException();
-	}
-
-	/**
-	 * Reads a 16-bit <code>short</code> value from this stream.
-	 * 
-	 * @return the next <code>short</code> value from the source stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this DataInputStream.
-	 * 
-	 * @see DataOutput#writeShort(int)
-	 */
-	public final short readShort() throws IOException {
-		int b1 = in.read();
-		int b2 = in.read();
-		if ((b1 | b2) >= 0)
-			return (short) ((b1 << 8) + b2);
-		throw new EOFException();
-	}
-
-	/**
-	 * Reads an unsigned 8-bit <code>byte</code> value from this stream and
-	 * returns it as an int.
-	 * 
-	 * @return the next unsigned byte value from the source stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this DataInputStream.
-	 * 
-	 * @see DataOutput#writeByte(int)
-	 */
-	public final int readUnsignedByte() throws IOException {
-		int temp = in.read();
-		if (temp >= 0)
-			return temp;
-		throw new EOFException();
-	}
-
-	/**
-	 * Reads a 16-bit unsigned <code>short</code> value from this stream and
-	 * returns it as an int.
-	 * 
-	 * @return the next unsigned <code>short</code> value from the source
-	 *         stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this DataInputStream.
-	 * 
-	 * @see DataOutput#writeShort(int)
-	 */
-	public final int readUnsignedShort() throws IOException {
-		int b1 = in.read();
-		int b2 = in.read();
-		if ((b1 | b2) >= 0)
-			return ((b1 << 8) + b2);
-		throw new EOFException();
-	}
-
-	/**
-	 * Reads a UTF format String from this Stream.
-	 * 
-	 * @return the next UTF String from the source stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this DataInputStream.
-	 * 
-	 * @see DataOutput#writeUTF(java.lang.String)
-	 */
-	public final String readUTF() throws IOException {
-		int utfSize = readUnsignedShort();
-		return decodeUTF(utfSize);
-	}
-
-	static final int MAX_BUF_SIZE = 8192;
-
-	static final Object cacheLock = new Object();
-	
-	static boolean useShared = true;
-
-	static byte[] byteBuf = new byte[0];
-
-	static char[] charBuf = new char[0];
-
-	String decodeUTF(int utfSize) throws IOException {
-		byte[] buf;
-		char[] out = null;
-		boolean makeBuf = true;
-
-		/*
-		 * Try to avoid the synchronization -- if we get a stale value for
-		 * useShared then there is no foul below, but those that sync on the
-		 * lock must see the right value.
-		 */
-		if (utfSize <= MAX_BUF_SIZE && useShared) {
-			synchronized (cacheLock) {
-				if (useShared) {
-					useShared = false;
-					makeBuf = false;
-				}
-			}
-		}
-		if (makeBuf) {
-			buf = new byte[utfSize];
-			out = new char[utfSize];
-		} else {
-			/*
-			 * Need to 'sample' byteBuf and charBuf before using them because
-			 * they are not protected by the cacheLock. They may get out of sync
-			 * with the static and one another, but that is ok because we
-			 * explicitly check and fix their length after sampling.
-			 */
-			buf = byteBuf;
-			if (buf.length < utfSize)
-				buf = byteBuf = new byte[utfSize];
-			out = charBuf;
-			if (out.length < utfSize) {
-				out = charBuf = new char[utfSize];
-			}
-		}
-
-		readFully(buf, 0, utfSize);
-		String result;
-		result = org.apache.harmony.luni.util.Util.convertUTF8WithBuf(buf, out, 0, utfSize);
-		if (!makeBuf) {
-			/*
-			 * Do not synchronize useShared on cacheLock, it will make it back
-			 * to main storage at some point, and no harm until it does.
-			 */
-			useShared = true;
-		}
-		return result;
-	}
-
-	/**
-	 * Reads a UTF format String from the DataInput Stream <code>in</code>.
-	 * 
-	 * @param in
-	 *            the input stream to read from
-	 * @return the next UTF String from the source stream.
-	 * 
-	 * @throws IOException
-	 *             If a problem occurs reading from this DataInputStream.
-	 * 
-	 * @see DataOutput#writeUTF(java.lang.String)
-	 */
-	public static final String readUTF(DataInput in) throws IOException {
-		return in.readUTF();
-	}
-
-	/**
-	 * Skips <code>count</code> number of bytes in this stream. Subsequent
-	 * <code>read()</code>'s will not return these bytes unless
-	 * <code>reset()</code> is used.
-	 * 
-	 * @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 final int skipBytes(int count) throws IOException {
-		int skipped = 0;
-		long skip;
-		while (skipped < count && (skip = in.skip(count - skipped)) != 0)
-			skipped += skip;
-		if (skipped >= 0)
-			return skipped;
-		throw new EOFException();
-	}
-
-}
+/* Copyright 1998, 2005 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;
+
+
+/**
+ * DataInputStream is a filter class which can read typed data from a Stream.
+ * Typically, this stream has been written by a DataOutputStream. Types that can
+ * be read include byte, 16-bit short, 32-bit int, 32-bit float, 64-bit long,
+ * 64-bit double, byte strings, and UTF Strings.
+ * 
+ * @see DataOutputStream
+ */
+public class DataInputStream extends FilterInputStream implements DataInput {
+	/**
+	 * Constructs a new DataInputStream on the InputStream <code>in</code>.
+	 * All reads can now be filtered through this stream. Note that data read by
+	 * this Stream is not in a human readable format and was most likely created
+	 * by a DataOutputStream.
+	 * 
+	 * @param in
+	 *            the target InputStream to filter reads on.
+	 * 
+	 * @see DataOutputStream
+	 * @see RandomAccessFile
+	 */
+	public DataInputStream(InputStream in) {
+		super(in);
+	}
+
+	/**
+	 * Reads bytes from the source stream into the byte array
+	 * <code>buffer</code>. The number of bytes actually read is returned.
+	 * 
+	 * @param buffer
+	 *            the buffer to read bytes into
+	 * @return the number of bytes actually read or -1 if end of stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this DataInputStream.
+	 * 
+	 * @see DataOutput#write(byte[])
+	 * @see DataOutput#write(byte[], int, int)
+	 */
+	public final int read(byte[] buffer) throws IOException {
+		return in.read(buffer, 0, buffer.length);
+	}
+
+	/**
+	 * Read at most <code>length</code> bytes from this DataInputStream 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.
+	 * 
+	 * @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 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 a problem occurs reading from this DataInputStream.
+	 * 
+	 * @see DataOutput#write(byte[])
+	 * @see DataOutput#write(byte[], int, int)
+	 */
+	public final int read(byte[] buffer, int offset, int length)
+			throws IOException {
+		return in.read(buffer, offset, length);
+	}
+
+	/**
+	 * Reads a boolean from this stream.
+	 * 
+	 * @return the next boolean value from the source stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this DataInputStream.
+	 * 
+	 * @see DataOutput#writeBoolean(boolean)
+	 */
+	public final boolean readBoolean() throws IOException {
+		int temp = in.read();
+		if (temp >= 0)
+			return temp != 0;
+		throw new EOFException();
+	}
+
+	/**
+	 * Reads an 8-bit byte value from this stream.
+	 * 
+	 * @return the next byte value from the source stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this DataInputStream.
+	 * 
+	 * @see DataOutput#writeByte(int)
+	 */
+	public final byte readByte() throws IOException {
+		int temp = in.read();
+		if (temp >= 0)
+			return (byte) temp;
+		throw new EOFException();
+	}
+
+	/**
+	 * Reads a 16-bit character value from this stream.
+	 * 
+	 * @return the next <code>char</code> value from the source stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this DataInputStream.
+	 * 
+	 * @see DataOutput#writeChar(int)
+	 */
+	public final char readChar() throws IOException {
+		int b1 = in.read();
+		int b2 = in.read();
+		if ((b1 | b2) >= 0)
+			return (char) ((b1 << 8) + b2);
+		throw new EOFException();
+	}
+
+	/**
+	 * Reads a 64-bit <code>double</code> value from this stream.
+	 * 
+	 * @return the next <code>double</code> value from the source stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this DataInputStream.
+	 * 
+	 * @see DataOutput#writeDouble(double)
+	 */
+	public final double readDouble() throws IOException {
+		return Double.longBitsToDouble(readLong());
+	}
+
+	/**
+	 * Reads a 32-bit <code>float</code> value from this stream.
+	 * 
+	 * @return the next <code>float</code> value from the source stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this DataInputStream.
+	 * 
+	 * @see DataOutput#writeFloat(float)
+	 */
+	public final float readFloat() throws IOException {
+		return Float.intBitsToFloat(readInt());
+	}
+
+	/**
+	 * Reads bytes from this stream into the byte array <code>buffer</code>.
+	 * This method will block until <code>buffer.length</code> number of bytes
+	 * have been read.
+	 * 
+	 * @param buffer
+	 *            to read bytes into
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this DataInputStream.
+	 * 
+	 * @see DataOutput#write(byte[])
+	 * @see DataOutput#write(byte[], int, int)
+	 */
+	public final void readFully(byte[] buffer) throws IOException {
+		readFully(buffer, 0, buffer.length);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.io.DataInput#readFully(byte[], int, int)
+	 */
+	public final void readFully(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) {
+				while (length > 0) {
+					int result = in.read(buffer, offset, length);
+					if (result >= 0) {
+						offset += result;
+						length -= result;
+					} else
+						throw new EOFException();
+				}
+			} else
+				throw new IndexOutOfBoundsException();
+		} else
+			throw new NullPointerException(org.apache.harmony.luni.util.Msg
+					.getString("K0047")); //$NON-NLS-1$
+	}
+
+	/**
+	 * Reads a 32-bit integer value from this stream.
+	 * 
+	 * @return the next <code>int</code> value from the source stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this DataInputStream.
+	 * 
+	 * @see DataOutput#writeInt(int)
+	 */
+	public final int readInt() throws IOException {
+		int b1 = in.read();
+		int b2 = in.read();
+		int b3 = in.read();
+		int b4 = in.read();
+		if ((b1 | b2 | b3 | b4) >= 0)
+			return ((b1 << 24) + (b2 << 16) + (b3 << 8) + b4);
+		throw new EOFException();
+	}
+
+	/**
+	 * Answers a <code>String</code> representing the next line of text
+	 * available in this BufferedReader. 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 the contents of the line or null if no characters were read
+	 *         before end of stream.
+	 * 
+	 * @throws IOException
+	 *             If the DataInputStream is already closed or some other IO
+	 *             error occurs.
+	 * 
+	 * @deprecated Use BufferedReader
+	 */
+	public final String readLine() throws IOException {
+		StringBuffer line = new StringBuffer(80); // Typical line length
+		boolean foundTerminator = false;
+		while (true) {
+			int nextByte = in.read();
+			switch (nextByte) {
+			case -1:
+				if (line.length() == 0 && !foundTerminator)
+					return null;
+				return line.toString();
+			case (byte) '\r':
+				if (foundTerminator) {
+					((PushbackInputStream) in).unread(nextByte);
+					return line.toString();
+				}
+				foundTerminator = true;
+				/* Have to be able to peek ahead one byte */
+				if (!(in.getClass() == PushbackInputStream.class))
+					in = new PushbackInputStream(in);
+				break;
+			case (byte) '\n':
+				return line.toString();
+			default:
+				if (foundTerminator) {
+					((PushbackInputStream) in).unread(nextByte);
+					return line.toString();
+				}
+				line.append((char) nextByte);
+			}
+		}
+	}
+
+	/**
+	 * Reads a 64-bit <code>long</code> value from this stream.
+	 * 
+	 * @return the next <code>long</code> value from the source stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this DataInputStream.
+	 * 
+	 * @see DataOutput#writeLong(long)
+	 */
+	public final long readLong() throws IOException {
+		int i1 = readInt();
+		int b1 = in.read();
+		int b2 = in.read();
+		int b3 = in.read();
+		int b4 = in.read();
+		if ((b1 | b2 | b3 | b4) >= 0)
+			return (((long) i1) << 32) + ((long) b1 << 24) + (b2 << 16)
+					+ (b3 << 8) + b4;
+		throw new EOFException();
+	}
+
+	/**
+	 * Reads a 16-bit <code>short</code> value from this stream.
+	 * 
+	 * @return the next <code>short</code> value from the source stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this DataInputStream.
+	 * 
+	 * @see DataOutput#writeShort(int)
+	 */
+	public final short readShort() throws IOException {
+		int b1 = in.read();
+		int b2 = in.read();
+		if ((b1 | b2) >= 0)
+			return (short) ((b1 << 8) + b2);
+		throw new EOFException();
+	}
+
+	/**
+	 * Reads an unsigned 8-bit <code>byte</code> value from this stream and
+	 * returns it as an int.
+	 * 
+	 * @return the next unsigned byte value from the source stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this DataInputStream.
+	 * 
+	 * @see DataOutput#writeByte(int)
+	 */
+	public final int readUnsignedByte() throws IOException {
+		int temp = in.read();
+		if (temp >= 0)
+			return temp;
+		throw new EOFException();
+	}
+
+	/**
+	 * Reads a 16-bit unsigned <code>short</code> value from this stream and
+	 * returns it as an int.
+	 * 
+	 * @return the next unsigned <code>short</code> value from the source
+	 *         stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this DataInputStream.
+	 * 
+	 * @see DataOutput#writeShort(int)
+	 */
+	public final int readUnsignedShort() throws IOException {
+		int b1 = in.read();
+		int b2 = in.read();
+		if ((b1 | b2) >= 0)
+			return ((b1 << 8) + b2);
+		throw new EOFException();
+	}
+
+	/**
+	 * Reads a UTF format String from this Stream.
+	 * 
+	 * @return the next UTF String from the source stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this DataInputStream.
+	 * 
+	 * @see DataOutput#writeUTF(java.lang.String)
+	 */
+	public final String readUTF() throws IOException {
+		int utfSize = readUnsignedShort();
+		return decodeUTF(utfSize);
+	}
+
+	static final int MAX_BUF_SIZE = 8192;
+
+	static final Object cacheLock = new Object();
+	
+	static boolean useShared = true;
+
+	static byte[] byteBuf = new byte[0];
+
+	static char[] charBuf = new char[0];
+
+	String decodeUTF(int utfSize) throws IOException {
+		byte[] buf;
+		char[] out = null;
+		boolean makeBuf = true;
+
+		/*
+		 * Try to avoid the synchronization -- if we get a stale value for
+		 * useShared then there is no foul below, but those that sync on the
+		 * lock must see the right value.
+		 */
+		if (utfSize <= MAX_BUF_SIZE && useShared) {
+			synchronized (cacheLock) {
+				if (useShared) {
+					useShared = false;
+					makeBuf = false;
+				}
+			}
+		}
+		if (makeBuf) {
+			buf = new byte[utfSize];
+			out = new char[utfSize];
+		} else {
+			/*
+			 * Need to 'sample' byteBuf and charBuf before using them because
+			 * they are not protected by the cacheLock. They may get out of sync
+			 * with the static and one another, but that is ok because we
+			 * explicitly check and fix their length after sampling.
+			 */
+			buf = byteBuf;
+			if (buf.length < utfSize)
+				buf = byteBuf = new byte[utfSize];
+			out = charBuf;
+			if (out.length < utfSize) {
+				out = charBuf = new char[utfSize];
+			}
+		}
+
+		readFully(buf, 0, utfSize);
+		String result;
+		result = org.apache.harmony.luni.util.Util.convertUTF8WithBuf(buf, out, 0, utfSize);
+		if (!makeBuf) {
+			/*
+			 * Do not synchronize useShared on cacheLock, it will make it back
+			 * to main storage at some point, and no harm until it does.
+			 */
+			useShared = true;
+		}
+		return result;
+	}
+
+	/**
+	 * Reads a UTF format String from the DataInput Stream <code>in</code>.
+	 * 
+	 * @param in
+	 *            the input stream to read from
+	 * @return the next UTF String from the source stream.
+	 * 
+	 * @throws IOException
+	 *             If a problem occurs reading from this DataInputStream.
+	 * 
+	 * @see DataOutput#writeUTF(java.lang.String)
+	 */
+	public static final String readUTF(DataInput in) throws IOException {
+		return in.readUTF();
+	}
+
+	/**
+	 * Skips <code>count</code> number of bytes in this stream. Subsequent
+	 * <code>read()</code>'s will not return these bytes unless
+	 * <code>reset()</code> is used.
+	 * 
+	 * @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 final int skipBytes(int count) throws IOException {
+		int skipped = 0;
+		long skip;
+		while (skipped < count && (skip = in.skip(count - skipped)) != 0)
+			skipped += skip;
+		if (skipped >= 0)
+			return skipped;
+		throw new EOFException();
+	}
+
+}

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/DataOutput.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/DataOutput.java?rev=432462&r1=432461&r2=432462&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/DataOutput.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/DataOutput.java Thu Aug 17 18:45:35 2006
@@ -1,234 +1,234 @@
-/* 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;
-
-
-/**
- * DataOutput is an interface which declares methods for writing typed data to a
- * Stream. Typically, this stream can be read in by a class which implements
- * DataInput. Types that can be written include byte, 16-bit short, 32-bit int,
- * 32-bit float, 64-bit long, 64-bit double, byte strings, and UTF Strings.
- * 
- * @see DataOutputStream
- * @see RandomAccessFile
- */
-public interface DataOutput {
-
-	/**
-	 * Writes the entire contents of the byte array <code>buffer</code> to the
-	 * OutputStream.
-	 * 
-	 * @param buffer
-	 *            the buffer to be written
-	 * 
-	 * @throws IOException
-	 *             If an error occurs attempting to write to this stream.
-	 * 
-	 * @see DataInput#readFully(byte[])
-	 * @see DataInput#readFully(byte[], int, int)
-	 */
-	public abstract void write(byte buffer[]) throws IOException;
-
-	/**
-	 * Writes <code>count</code> <code>bytes</code> from the byte array
-	 * <code>buffer</code> starting at offset <code>index</code> to the
-	 * OutputStream.
-	 * 
-	 * @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 IOException
-	 *             If an error occurs attempting to write to this stream.
-	 * 
-	 * @see DataInput#readFully(byte[])
-	 * @see DataInput#readFully(byte[], int, int)
-	 */
-	public abstract void write(byte buffer[], int offset, int count)
-			throws IOException;
-
-	/**
-	 * Writes the specified <code>byte</code> to the OutputStream.
-	 * 
-	 * @param oneByte
-	 *            the byte to be written
-	 * 
-	 * @throws IOException
-	 *             If an error occurs attempting to write to this stream.
-	 * 
-	 * @see DataInput#readByte()
-	 */
-	public abstract void write(int oneByte) throws IOException;
-
-	/**
-	 * Writes a boolean to this output stream.
-	 * 
-	 * @param val
-	 *            the boolean value to write to the OutputStream
-	 * 
-	 * @throws IOException
-	 *             If an error occurs attempting to write to this stream.
-	 * 
-	 * @see DataInput#readBoolean()
-	 */
-	public abstract void writeBoolean(boolean val) throws IOException;
-
-	/**
-	 * Writes a 8-bit byte to this output stream.
-	 * 
-	 * @param val
-	 *            the byte value to write to the OutputStream
-	 * 
-	 * @throws IOException
-	 *             If an error occurs attempting to write to this stream.
-	 * 
-	 * @see DataInput#readByte()
-	 * @see DataInput#readUnsignedByte()
-	 */
-	public abstract void writeByte(int val) throws IOException;
-
-	/**
-	 * Writes the low order 8-bit bytes from a String to this output stream.
-	 * 
-	 * @param str
-	 *            the String containing the bytes to write to the OutputStream
-	 * 
-	 * @throws IOException
-	 *             If an error occurs attempting to write to this stream.
-	 * 
-	 * @see DataInput#readFully(byte[])
-	 * @see DataInput#readFully(byte[],int,int)
-	 */
-	public abstract void writeBytes(String str) throws IOException;
-
-	/**
-	 * Writes the specified 16-bit character to the OutputStream. Only the lower
-	 * 2 bytes are written with the higher of the 2 bytes written first. This
-	 * represents the Unicode value of val.
-	 * 
-	 * @param oneByte
-	 *            the character to be written
-	 * 
-	 * @throws IOException
-	 *             If an error occurs attempting to write to this stream.
-	 * 
-	 * @see DataInput#readChar()
-	 */
-	public abstract void writeChar(int oneByte) throws IOException;
-
-	/**
-	 * Writes the specified 16-bit characters contained in str to the
-	 * OutputStream. Only the lower 2 bytes of each character are written with
-	 * the higher of the 2 bytes written first. This represents the Unicode
-	 * value of each character in str.
-	 * 
-	 * @param str
-	 *            the String whose characters are to be written.
-	 * 
-	 * @throws IOException
-	 *             If an error occurs attempting to write to this stream.
-	 * 
-	 * @see DataInput#readChar()
-	 */
-	public abstract void writeChars(String str) throws IOException;
-
-	/**
-	 * Writes a 64-bit double to this output stream. The resulting output is the
-	 * 8 bytes resulting from calling Double.doubleToLongBits().
-	 * 
-	 * @param val
-	 *            the double to be written.
-	 * 
-	 * @throws IOException
-	 *             If an error occurs attempting to write to this stream.
-	 * 
-	 * @see DataInput#readDouble()
-	 */
-	public abstract void writeDouble(double val) throws IOException;
-
-	/**
-	 * Writes a 32-bit float to this output stream. The resulting output is the
-	 * 4 bytes resulting from calling Float.floatToIntBits().
-	 * 
-	 * @param val
-	 *            the float to be written.
-	 * 
-	 * @throws IOException
-	 *             If an error occurs attempting to write to this stream.
-	 * 
-	 * @see DataInput#readFloat()
-	 */
-	public abstract void writeFloat(float val) throws IOException;
-
-	/**
-	 * Writes a 32-bit int to this output stream. The resulting output is the 4
-	 * bytes, highest order first, of val.
-	 * 
-	 * @param val
-	 *            the int to be written.
-	 * 
-	 * @throws IOException
-	 *             If an error occurs attempting to write to this stream.
-	 * 
-	 * @see DataInput#readInt()
-	 */
-	public abstract void writeInt(int val) throws IOException;
-
-	/**
-	 * Writes a 64-bit long to this output stream. The resulting output is the 8
-	 * bytes, highest order first, of val.
-	 * 
-	 * @param val
-	 *            the long to be written.
-	 * 
-	 * @throws IOException
-	 *             If an error occurs attempting to write to this stream.
-	 * 
-	 * @see DataInput#readLong()
-	 */
-	public abstract void writeLong(long val) throws IOException;
-
-	/**
-	 * Writes the specified 16-bit short to the OutputStream. Only the lower 2
-	 * bytes are written with the higher of the 2 bytes written first.
-	 * 
-	 * @param val
-	 *            the short to be written
-	 * 
-	 * @throws IOException
-	 *             If an error occurs attempting to write to this stream.
-	 * 
-	 * @see DataInput#readShort()
-	 * @see DataInput#readUnsignedShort()
-	 */
-	public abstract void writeShort(int val) throws IOException;
-
-	/**
-	 * Writes the specified String out in UTF format.
-	 * 
-	 * @param str
-	 *            the String to be written in UTF format.
-	 * 
-	 * @throws IOException
-	 *             If an error occurs attempting to write to this stream.
-	 * 
-	 * @see DataInput#readUTF()
-	 */
-	public abstract void writeUTF(String str) 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;
+
+
+/**
+ * DataOutput is an interface which declares methods for writing typed data to a
+ * Stream. Typically, this stream can be read in by a class which implements
+ * DataInput. Types that can be written include byte, 16-bit short, 32-bit int,
+ * 32-bit float, 64-bit long, 64-bit double, byte strings, and UTF Strings.
+ * 
+ * @see DataOutputStream
+ * @see RandomAccessFile
+ */
+public interface DataOutput {
+
+	/**
+	 * Writes the entire contents of the byte array <code>buffer</code> to the
+	 * OutputStream.
+	 * 
+	 * @param buffer
+	 *            the buffer to be written
+	 * 
+	 * @throws IOException
+	 *             If an error occurs attempting to write to this stream.
+	 * 
+	 * @see DataInput#readFully(byte[])
+	 * @see DataInput#readFully(byte[], int, int)
+	 */
+	public abstract void write(byte buffer[]) throws IOException;
+
+	/**
+	 * Writes <code>count</code> <code>bytes</code> from the byte array
+	 * <code>buffer</code> starting at offset <code>index</code> to the
+	 * OutputStream.
+	 * 
+	 * @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 IOException
+	 *             If an error occurs attempting to write to this stream.
+	 * 
+	 * @see DataInput#readFully(byte[])
+	 * @see DataInput#readFully(byte[], int, int)
+	 */
+	public abstract void write(byte buffer[], int offset, int count)
+			throws IOException;
+
+	/**
+	 * Writes the specified <code>byte</code> to the OutputStream.
+	 * 
+	 * @param oneByte
+	 *            the byte to be written
+	 * 
+	 * @throws IOException
+	 *             If an error occurs attempting to write to this stream.
+	 * 
+	 * @see DataInput#readByte()
+	 */
+	public abstract void write(int oneByte) throws IOException;
+
+	/**
+	 * Writes a boolean to this output stream.
+	 * 
+	 * @param val
+	 *            the boolean value to write to the OutputStream
+	 * 
+	 * @throws IOException
+	 *             If an error occurs attempting to write to this stream.
+	 * 
+	 * @see DataInput#readBoolean()
+	 */
+	public abstract void writeBoolean(boolean val) throws IOException;
+
+	/**
+	 * Writes a 8-bit byte to this output stream.
+	 * 
+	 * @param val
+	 *            the byte value to write to the OutputStream
+	 * 
+	 * @throws IOException
+	 *             If an error occurs attempting to write to this stream.
+	 * 
+	 * @see DataInput#readByte()
+	 * @see DataInput#readUnsignedByte()
+	 */
+	public abstract void writeByte(int val) throws IOException;
+
+	/**
+	 * Writes the low order 8-bit bytes from a String to this output stream.
+	 * 
+	 * @param str
+	 *            the String containing the bytes to write to the OutputStream
+	 * 
+	 * @throws IOException
+	 *             If an error occurs attempting to write to this stream.
+	 * 
+	 * @see DataInput#readFully(byte[])
+	 * @see DataInput#readFully(byte[],int,int)
+	 */
+	public abstract void writeBytes(String str) throws IOException;
+
+	/**
+	 * Writes the specified 16-bit character to the OutputStream. Only the lower
+	 * 2 bytes are written with the higher of the 2 bytes written first. This
+	 * represents the Unicode value of val.
+	 * 
+	 * @param oneByte
+	 *            the character to be written
+	 * 
+	 * @throws IOException
+	 *             If an error occurs attempting to write to this stream.
+	 * 
+	 * @see DataInput#readChar()
+	 */
+	public abstract void writeChar(int oneByte) throws IOException;
+
+	/**
+	 * Writes the specified 16-bit characters contained in str to the
+	 * OutputStream. Only the lower 2 bytes of each character are written with
+	 * the higher of the 2 bytes written first. This represents the Unicode
+	 * value of each character in str.
+	 * 
+	 * @param str
+	 *            the String whose characters are to be written.
+	 * 
+	 * @throws IOException
+	 *             If an error occurs attempting to write to this stream.
+	 * 
+	 * @see DataInput#readChar()
+	 */
+	public abstract void writeChars(String str) throws IOException;
+
+	/**
+	 * Writes a 64-bit double to this output stream. The resulting output is the
+	 * 8 bytes resulting from calling Double.doubleToLongBits().
+	 * 
+	 * @param val
+	 *            the double to be written.
+	 * 
+	 * @throws IOException
+	 *             If an error occurs attempting to write to this stream.
+	 * 
+	 * @see DataInput#readDouble()
+	 */
+	public abstract void writeDouble(double val) throws IOException;
+
+	/**
+	 * Writes a 32-bit float to this output stream. The resulting output is the
+	 * 4 bytes resulting from calling Float.floatToIntBits().
+	 * 
+	 * @param val
+	 *            the float to be written.
+	 * 
+	 * @throws IOException
+	 *             If an error occurs attempting to write to this stream.
+	 * 
+	 * @see DataInput#readFloat()
+	 */
+	public abstract void writeFloat(float val) throws IOException;
+
+	/**
+	 * Writes a 32-bit int to this output stream. The resulting output is the 4
+	 * bytes, highest order first, of val.
+	 * 
+	 * @param val
+	 *            the int to be written.
+	 * 
+	 * @throws IOException
+	 *             If an error occurs attempting to write to this stream.
+	 * 
+	 * @see DataInput#readInt()
+	 */
+	public abstract void writeInt(int val) throws IOException;
+
+	/**
+	 * Writes a 64-bit long to this output stream. The resulting output is the 8
+	 * bytes, highest order first, of val.
+	 * 
+	 * @param val
+	 *            the long to be written.
+	 * 
+	 * @throws IOException
+	 *             If an error occurs attempting to write to this stream.
+	 * 
+	 * @see DataInput#readLong()
+	 */
+	public abstract void writeLong(long val) throws IOException;
+
+	/**
+	 * Writes the specified 16-bit short to the OutputStream. Only the lower 2
+	 * bytes are written with the higher of the 2 bytes written first.
+	 * 
+	 * @param val
+	 *            the short to be written
+	 * 
+	 * @throws IOException
+	 *             If an error occurs attempting to write to this stream.
+	 * 
+	 * @see DataInput#readShort()
+	 * @see DataInput#readUnsignedShort()
+	 */
+	public abstract void writeShort(int val) throws IOException;
+
+	/**
+	 * Writes the specified String out in UTF format.
+	 * 
+	 * @param str
+	 *            the String to be written in UTF format.
+	 * 
+	 * @throws IOException
+	 *             If an error occurs attempting to write to this stream.
+	 * 
+	 * @see DataInput#readUTF()
+	 */
+	public abstract void writeUTF(String str) throws IOException;
+}

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



Mime
View raw message