Author: ndbeyer
Date: Tue Aug 29 21:10:04 2006
New Revision: 438343
URL: http://svn.apache.org/viewvc?rev=438343&view=rev
Log:
java.io code cleanup; add braces, remove unecessary initialization and compiler warnings
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectStreamClass.java
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectStreamField.java
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/OutputStreamWriter.java
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedInputStream.java
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedReader.java
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedWriter.java
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PrintStream.java
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PrintWriter.java
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/SequenceInputStream.java
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StreamTokenizer.java
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StringBufferInputStream.java
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StringReader.java
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StringWriter.java
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/WriteAbortedException.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java?rev=438343&r1=438342&r2=438343&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectInputStream.java Tue Aug 29 21:10:04 2006
@@ -1399,6 +1399,7 @@
*
* @deprecated Use BufferedReader
*/
+ @SuppressWarnings("deprecation")
@Deprecated
public String readLine() throws IOException {
return primitiveTypes.readLine();
@@ -1593,6 +1594,8 @@
}
return classDesc;
}
+
+ @SuppressWarnings("unchecked") //For the Enum.valueOf call
private Object readEnum(boolean unshared) throws OptionalDataException,
ClassNotFoundException, IOException {
// read classdesc for Enum first
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectStreamClass.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectStreamClass.java?rev=438343&r1=438342&r2=438343&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectStreamClass.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectStreamClass.java Tue Aug 29 21:10:04 2006
@@ -1080,7 +1080,8 @@
*
* @return a printable representation for the receiver.
*/
- public String toString() {
+ @Override
+ public String toString() {
return getName() + ": static final long serialVersionUID =" //$NON-NLS-1$
+ getSerialVersionUID() + "L;"; //$NON-NLS-1$
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectStreamField.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectStreamField.java?rev=438343&r1=438342&r2=438343&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectStreamField.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/ObjectStreamField.java Tue Aug 29 21:10:04 2006
@@ -255,7 +255,8 @@
*
* @return a printable representation for the receiver.
*/
- public String toString() {
+ @Override
+ public String toString() {
return this.getClass().getName() + '(' + getName() + ':' + getTypeInternal()
+ ')';
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/OutputStreamWriter.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/OutputStreamWriter.java?rev=438343&r1=438342&r2=438343&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/OutputStreamWriter.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/OutputStreamWriter.java Tue Aug 29 21:10:04 2006
@@ -142,7 +142,8 @@
* If an error occurs attempting to close this
* OutputStreamWriter.
*/
- public void close() throws IOException {
+ @Override
+ public void close() throws IOException {
synchronized (lock) {
if (encoder != null) {
encoder.flush(bytes);
@@ -165,7 +166,8 @@
* OutputStreamWriter.
*/
- public void flush() throws IOException {
+ @Override
+ public void flush() throws IOException {
synchronized (lock) {
checkStatus();
int position;
@@ -221,7 +223,8 @@
* @throws IndexOutOfBoundsException
* If offset or count is outside of bounds.
*/
- public void write(char[] buf, int offset, int count) throws IOException {
+ @Override
+ public void write(char[] buf, int offset, int count) throws IOException {
synchronized (lock) {
checkStatus();
if (offset < 0 || offset > buf.length - count || count < 0) {
@@ -260,7 +263,8 @@
* If this OutputStreamWriter has already been closed or some
* other IOException occurs.
*/
- public void write(int oneChar) throws IOException {
+ @Override
+ public void write(int oneChar) throws IOException {
synchronized (lock) {
checkStatus();
CharBuffer chars = CharBuffer.wrap(new char[] { (char) oneChar });
@@ -290,7 +294,8 @@
* @throws StringIndexOutOfBoundsException
* If offset is negative or offset + count is outside of bounds
*/
- public void write(String str, int offset, int count) throws IOException {
+ @Override
+ public void write(String str, int offset, int count) throws IOException {
synchronized (lock) {
// avoid int overflow
if (count < 0) {
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedInputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedInputStream.java?rev=438343&r1=438342&r2=438343&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedInputStream.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedInputStream.java Tue Aug 29 21:10:04 2006
@@ -87,9 +87,11 @@
* @throws IOException
* If an error occurs in this stream.
*/
- public synchronized int available() throws IOException {
- if (buffer == null || in == -1)
- return 0;
+ @Override
+ public synchronized int available() throws IOException {
+ if (buffer == null || in == -1) {
+ return 0;
+ }
return in <= out ? buffer.length - out + in : in - out;
}
@@ -100,7 +102,8 @@
* @throws IOException
* If an error occurs attempting to close this stream.
*/
- public void close() throws IOException {
+ @Override
+ public void close() throws IOException {
synchronized (this) {
/* No exception thrown if already closed */
if (buffer != null) {
@@ -139,7 +142,8 @@
* If the stream is already closed or another IOException
* occurs.
*/
- public synchronized int read() throws IOException {
+ @Override
+ public synchronized int read() throws IOException {
if (isConnected) {
if (buffer != null) {
/**
@@ -152,12 +156,14 @@
boolean first = true;
while (in == -1) {
// Are we at end of stream?
- if (isClosed)
- return -1;
+ if (isClosed) {
+ return -1;
+ }
if (!first && lastWriter != null
- && !lastWriter.isAlive())
- throw new IOException(org.apache.harmony.luni.util.Msg
+ && !lastWriter.isAlive()) {
+ throw new IOException(org.apache.harmony.luni.util.Msg
.getString("K0076")); //$NON-NLS-1$
+ }
first = false;
// Notify callers of receive()
notifyAll();
@@ -168,8 +174,9 @@
}
byte result = buffer[out++];
- if (out == buffer.length)
- out = 0;
+ if (out == buffer.length) {
+ out = 0;
+ }
if (out == in) {
// empty buffer
in = -1;
@@ -203,12 +210,14 @@
* If the stream is already closed or another IOException
* occurs.
*/
- public synchronized int read(byte[] bytes, int offset, int count)
+ @Override
+ public synchronized int read(byte[] bytes, int offset, int count)
throws IOException {
if (bytes != null && 0 <= offset && offset <= bytes.length
&& 0 <= count && count <= bytes.length - offset) {
- if (count == 0)
- return 0;
+ if (count == 0) {
+ return 0;
+ }
if (isConnected && buffer != null) {
/**
* Set the last thread to be reading on this PipedInputStream.
@@ -220,12 +229,14 @@
boolean first = true;
while (in == -1) {
// Are we at end of stream?
- if (isClosed)
- return -1;
+ if (isClosed) {
+ return -1;
+ }
if (!first && lastWriter != null
- && !lastWriter.isAlive())
- throw new IOException(org.apache.harmony.luni.util.Msg
+ && !lastWriter.isAlive()) {
+ throw new IOException(org.apache.harmony.luni.util.Msg
.getString("K0076")); //$NON-NLS-1$
+ }
first = false;
// Notify callers of receive()
notifyAll();
@@ -242,8 +253,9 @@
- out : count;
System.arraycopy(buffer, out, bytes, offset, copyLength);
out += copyLength;
- if (out == buffer.length)
- out = 0;
+ if (out == buffer.length) {
+ out = 0;
+ }
if (out == in) {
// empty buffer
in = -1;
@@ -255,8 +267,9 @@
* Did the read fully succeed in the previous copy or is the
* buffer empty?
*/
- if (copyLength == count || in == -1)
- return copyLength;
+ if (copyLength == count || in == -1) {
+ return copyLength;
+ }
int bytesCopied = copyLength;
/* Copy bytes from 0 to the number of available bytes */
@@ -315,19 +328,22 @@
while (buffer != null && out == in) {
notifyAll();
wait(1000);
- if (lastReader != null && !lastReader.isAlive())
- throw new IOException(org.apache.harmony.luni.util.Msg
+ if (lastReader != null && !lastReader.isAlive()) {
+ throw new IOException(org.apache.harmony.luni.util.Msg
.getString("K0076")); //$NON-NLS-1$
+ }
}
} catch (InterruptedException e) {
throw new InterruptedIOException();
}
if (buffer != null) {
- if (in == -1)
- in = 0;
+ if (in == -1) {
+ in = 0;
+ }
buffer[in++] = (byte) oneByte;
- if (in == buffer.length)
- in = 0;
+ if (in == buffer.length) {
+ in = 0;
+ }
return;
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedReader.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedReader.java?rev=438343&r1=438342&r2=438343&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedReader.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedReader.java Tue Aug 29 21:10:04 2006
@@ -15,6 +15,8 @@
package java.io;
+import org.apache.harmony.luni.util.Msg;
+
/**
* PipedReader is a class which receives information on a communications pipe.
@@ -23,9 +25,11 @@
*
*/
public class PipedReader extends Reader {
- private Thread lastReader, lastWriter;
+ private Thread lastReader;
+
+ private Thread lastWriter;
- private boolean isClosed = false;
+ private boolean isClosed;
/**
* The circular buffer through which data is passed.
@@ -41,7 +45,7 @@
/**
* The index in <code>buffer</code> where the next character will be read.
*/
- private int out = 0;
+ private int out;
/**
* The size of the default pipe in characters
@@ -51,7 +55,7 @@
/**
* Indicates if this pipe is connected
*/
- private boolean isConnected = false;
+ private boolean isConnected;
/**
* Constructs a new unconnected PipedReader. The resulting Reader must be
@@ -84,7 +88,8 @@
* @throws IOException
* If an error occurs attempting to close this reader.
*/
- public void close() throws IOException {
+ @Override
+ public void close() throws IOException {
synchronized (lock) {
/* No exception thrown if already closed */
if (data != null) {
@@ -118,12 +123,14 @@
*/
void establishConnection() throws IOException {
synchronized (lock) {
- if (data == null)
- throw new IOException(org.apache.harmony.luni.util.Msg.getString("K0078")); //$NON-NLS-1$
+ if (data == null) {
+ throw new IOException(Msg.getString("K0078")); //$NON-NLS-1$
+ }
if (!isConnected) {
isConnected = true;
- } else
- throw new IOException(org.apache.harmony.luni.util.Msg.getString("K007a")); //$NON-NLS-1$
+ } else {
+ throw new IOException(Msg.getString("K007a")); //$NON-NLS-1$
+ }
}
}
@@ -140,7 +147,8 @@
* If the reader is already closed or another IOException
* occurs.
*/
- public int read() throws IOException {
+ @Override
+ public int read() throws IOException {
char[] carray = new char[1];
int result = read(carray, 0, 1);
return result != -1 ? carray[0] : result;
@@ -156,7 +164,7 @@
* interacts a reader or writer pipe.
*
* @param buffer
- * the charcter array in which to store the read characters.
+ * the character array in which to store the read characters.
* @param offset
* the offset in <code>buffer</code> to store the read
* characters.
@@ -170,22 +178,22 @@
* If the reader is already closed or another IOException
* occurs.
*/
- public int read(char[] buffer, int offset, int count) throws IOException {
+ @Override
+ public int read(char[] buffer, int offset, int count) throws IOException {
synchronized (lock) {
if (!isConnected) {
- throw new IOException(org.apache.harmony.luni.util.Msg
- .getString("K007b")); //$NON-NLS-1$
+ throw new IOException(Msg.getString("K007b")); //$NON-NLS-1$
}
if (data == null) {
- throw new IOException(org.apache.harmony.luni.util.Msg
- .getString("K0078")); //$NON-NLS-1$
+ throw new IOException(Msg.getString("K0078")); //$NON-NLS-1$
}
// avoid int overflow
if (offset < 0 || count > buffer.length - offset || count < 0) {
throw new IndexOutOfBoundsException();
}
- if (count == 0)
+ if (count == 0) {
return 0;
+ }
/**
* Set the last thread to be reading on this PipedReader. If
* lastReader dies while someone is waiting to write an IOException
@@ -196,11 +204,12 @@
boolean first = true;
while (in == -1) {
// Are we at end of stream?
- if (isClosed)
+ if (isClosed) {
return -1;
- if (!first && lastWriter != null && !lastWriter.isAlive())
- throw new IOException(org.apache.harmony.luni.util.Msg
- .getString("K0076")); //$NON-NLS-1$
+ }
+ if (!first && lastWriter != null && !lastWriter.isAlive()) {
+ throw new IOException(Msg.getString("K0076")); //$NON-NLS-1$
+ }
first = false;
// Notify callers of receive()
notifyAll();
@@ -213,12 +222,12 @@
int copyLength = 0;
/* Copy chars from out to end of buffer first */
if (out >= in) {
- copyLength = count > data.length - out ? data.length - out
- : count;
+ copyLength = count > data.length - out ? data.length - out : count;
System.arraycopy(data, out, buffer, offset, copyLength);
out += copyLength;
- if (out == data.length)
+ if (out == data.length) {
out = 0;
+ }
if (out == in) {
// empty buffer
in = -1;
@@ -230,13 +239,13 @@
* Did the read fully succeed in the previous copy or is the buffer
* empty?
*/
- if (copyLength == count || in == -1)
+ if (copyLength == count || in == -1) {
return copyLength;
+ }
int charsCopied = copyLength;
/* Copy bytes from 0 to the number of available bytes */
- copyLength = in - out > count - copyLength ? count - copyLength
- : in - out;
+ copyLength = in - out > count - copyLength ? count - copyLength : in - out;
System.arraycopy(data, out, buffer, offset + charsCopied,
copyLength);
out += copyLength;
@@ -258,17 +267,18 @@
*
* @throws IOException If the reader is already closed or another IOException occurs.
*/
- public boolean ready() throws IOException {
- synchronized (lock) {
- if (isConnected) {
- if (data != null) {
- return in != -1;
- }
- throw new IOException(org.apache.harmony.luni.util.Msg.getString("K0078")); //$NON-NLS-1$
- }
- throw new IOException(org.apache.harmony.luni.util.Msg.getString("K007b")); //$NON-NLS-1$
- }
- }
+ @Override
+ public boolean ready() throws IOException {
+ synchronized (lock) {
+ if (isConnected) {
+ if (data != null) {
+ return in != -1;
+ }
+ throw new IOException(Msg.getString("K0078")); //$NON-NLS-1$
+ }
+ throw new IOException(Msg.getString("K007b")); //$NON-NLS-1$
+ }
+ }
/**
* Receives a char and stores it into the PipedReader. This called by
@@ -287,14 +297,12 @@
void receive(char oneChar) throws IOException {
synchronized (lock) {
if (data == null) {
- throw new IOException(org.apache.harmony.luni.util.Msg
- .getString("K0078")); //$NON-NLS-1$
+ throw new IOException(Msg.getString("K0078")); //$NON-NLS-1$
}
if (lastReader != null && !lastReader.isAlive()) {
- throw new IOException(org.apache.harmony.luni.util.Msg
- .getString("K0076")); //$NON-NLS-1$
+ throw new IOException(Msg.getString("K0076")); //$NON-NLS-1$
}
- /**
+ /*
* Set the last thread to be writing on this PipedWriter. If
* lastWriter dies while someone is waiting to read an IOException
* of "Pipe broken" will be thrown in read()
@@ -305,19 +313,20 @@
notifyAll();
wait(1000);
if (lastReader != null && !lastReader.isAlive()) {
- throw new IOException(org.apache.harmony.luni.util.Msg
- .getString("K0076")); //$NON-NLS-1$
+ throw new IOException(Msg.getString("K0076")); //$NON-NLS-1$
}
}
} catch (InterruptedException e) {
throw new InterruptedIOException();
}
if (data != null) {
- if (in == -1)
+ if (in == -1) {
in = 0;
+ }
data[in++] = oneChar;
- if (in == data.length)
+ if (in == data.length) {
in = 0;
+ }
return;
}
}
@@ -344,12 +353,10 @@
void receive(char[] chars, int offset, int count) throws IOException {
synchronized (lock) {
if (data == null) {
- throw new IOException(org.apache.harmony.luni.util.Msg
- .getString("K0078")); //$NON-NLS-1$
+ throw new IOException(Msg.getString("K0078")); //$NON-NLS-1$
}
if (lastReader != null && !lastReader.isAlive()) {
- throw new IOException(org.apache.harmony.luni.util.Msg
- .getString("K0076")); //$NON-NLS-1$
+ throw new IOException(Msg.getString("K0076")); //$NON-NLS-1$
}
/**
* Set the last thread to be writing on this PipedWriter. If
@@ -363,41 +370,45 @@
notifyAll();
wait(1000);
if (lastReader != null && !lastReader.isAlive()) {
- throw new IOException(
- org.apache.harmony.luni.util.Msg
- .getString("K0076")); //$NON-NLS-1$
+ throw new IOException(Msg.getString("K0076")); //$NON-NLS-1$
}
}
} catch (InterruptedException e) {
throw new InterruptedIOException();
}
- if (data == null)
+ if (data == null) {
break;
- if (in == -1)
+ }
+ if (in == -1) {
in = 0;
+ }
if (in >= out) {
int length = data.length - in;
- if (count < length)
+ if (count < length) {
length = count;
+ }
System.arraycopy(chars, offset, data, in, length);
offset += length;
count -= length;
in += length;
- if (in == data.length)
+ if (in == data.length) {
in = 0;
+ }
}
if (count > 0 && in != out) {
int length = out - in;
- if (count < length)
+ if (count < length) {
length = count;
+ }
System.arraycopy(chars, offset, data, in, length);
offset += length;
count -= length;
in += length;
}
}
- if (count == 0)
+ if (count == 0) {
return;
+ }
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedWriter.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedWriter.java?rev=438343&r1=438342&r2=438343&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedWriter.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PipedWriter.java Tue Aug 29 21:10:04 2006
@@ -15,6 +15,8 @@
package java.io;
+import org.apache.harmony.luni.util.Msg;
+
/**
* PipedWriter is a class which places information on a communications pipe.
@@ -29,7 +31,7 @@
*/
private PipedReader dest;
- private boolean closed = false;
+ private boolean closed;
/**
* Constructs a new unconnected PipedWriter. The resulting Stream must be
@@ -63,7 +65,8 @@
* @throws java.io.IOException
* If an error occurs attempting to close this PipedWriter.
*/
- public void close() throws IOException {
+ @Override
+ public void close() throws IOException {
synchronized (lock) {
/* Is the pipe connected? */
if (dest != null) {
@@ -90,11 +93,12 @@
if (!closed) {
stream.establishConnection();
this.dest = stream;
- } else
- throw new IOException(org.apache.harmony.luni.util.Msg
- .getString("K0078")); //$NON-NLS-1$
- } else
- throw new IOException(org.apache.harmony.luni.util.Msg.getString("K0079")); //$NON-NLS-1$
+ } else {
+ throw new IOException(Msg.getString("K0078")); //$NON-NLS-1$
+ }
+ } else {
+ throw new IOException(Msg.getString("K0079")); //$NON-NLS-1$
+ }
}
}
@@ -105,9 +109,11 @@
* @throws java.io.IOException
* If an IO error occurs during the flush.
*/
- public void flush() throws IOException {
- if (dest != null)
- dest.flush();
+ @Override
+ public void flush() throws IOException {
+ if (dest != null) {
+ dest.flush();
+ }
}
/**
@@ -137,24 +143,24 @@
* @throws java.lang.IllegalArgumentException
* If any of the arguments are out of bounds.
*/
- public void write(char buffer[], int offset, int count) throws IOException {
+ @Override
+ public void write(char buffer[], int offset, int count) throws IOException {
if (buffer == null) {
- throw new NullPointerException(org.apache.harmony.luni.util.Msg
- .getString("K0047")); //$NON-NLS-1$
+ throw new NullPointerException(Msg.getString("K0047")); //$NON-NLS-1$
}
// avoid int overflow
if (0 <= offset && offset <= buffer.length && 0 <= count
&& count <= buffer.length - offset) {
synchronized (lock) {
if (!closed) {
- if (dest != null)
- dest.receive(buffer, offset, count);
- else
- throw new IOException(org.apache.harmony.luni.util.Msg
- .getString("K007b")); //$NON-NLS-1$
- } else
- throw new IOException(org.apache.harmony.luni.util.Msg
- .getString("K0078")); //$NON-NLS-1$
+ if (dest != null) {
+ dest.receive(buffer, offset, count);
+ } else {
+ throw new IOException(Msg.getString("K007b")); //$NON-NLS-1$
+ }
+ } else {
+ throw new IOException(Msg.getString("K0078")); //$NON-NLS-1$
+ }
}
} else {
throw new IndexOutOfBoundsException();
@@ -181,16 +187,18 @@
* @throws java.lang.NullPointerException
* If the receiver has not been connected yet.
*/
- public void write(int c) throws IOException {
+ @Override
+ public void write(int c) throws IOException {
synchronized (lock) {
if (!closed) {
- if (dest != null)
- dest.receive((char) c);
- else
- throw new IOException(org.apache.harmony.luni.util.Msg
- .getString("K007b")); //$NON-NLS-1$
- } else
- throw new IOException(org.apache.harmony.luni.util.Msg.getString("K0078")); //$NON-NLS-1$
+ if (dest != null) {
+ dest.receive((char) c);
+ } else {
+ throw new IOException(Msg.getString("K007b")); //$NON-NLS-1$
+ }
+ } else {
+ throw new IOException(Msg.getString("K0078")); //$NON-NLS-1$
+ }
}
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PrintStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PrintStream.java?rev=438343&r1=438342&r2=438343&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PrintStream.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PrintStream.java Tue Aug 29 21:10:04 2006
@@ -36,6 +36,8 @@
public class PrintStream extends FilterOutputStream implements Appendable,
Closeable {
+ private static final String TOKEN_NULL = "null"; //$NON-NLS-1$
+
/**
* protect writes to the underlying stream.
*/
@@ -44,21 +46,19 @@
/**
* indicates whether or not this PrintStream has incurred an error.
*/
- boolean ioError;
+ private boolean ioError;
/**
* indicates whether or not this PrintStream should flush its contents after
* printing a new line.
*/
- boolean autoflush;
+ private boolean autoflush;
private String encoding;
private final String lineSeparator = AccessController
.doPrivileged(new PriviAction<String>("line.separator")); //$NON-NLS-1$
- static final String TOKEN_NULL = "null"; //$NON-NLS-1$
-
// private Formatter formatter;
/**
@@ -240,7 +240,8 @@
* <code>true</code>.
*
*/
- public void close() {
+ @Override
+ public void close() {
synchronized (lock) {
flush();
if (out != null) {
@@ -260,7 +261,8 @@
* If an error occurs, set an error in this PrintStream to <code>true</code>.
*
*/
- public void flush() {
+ @Override
+ public void flush() {
synchronized (lock) {
if (out != null) {
try {
@@ -643,7 +645,8 @@
* @throws IndexOutOfBoundsException
* If offset or count are outside of bounds.
*/
- public void write(byte[] buffer, int offset, int count) {
+ @Override
+ public void write(byte[] buffer, int offset, int count) {
if (buffer != null) {
// avoid int overflow
if (0 <= offset && offset <= buffer.length && 0 <= count
@@ -681,7 +684,8 @@
* @param oneByte
* the byte to be written
*/
- public void write(int oneByte) {
+ @Override
+ public void write(int oneByte) {
synchronized (lock) {
if (out == null) {
setError();
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PrintWriter.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PrintWriter.java?rev=438343&r1=438342&r2=438343&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PrintWriter.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/PrintWriter.java Tue Aug 29 21:10:04 2006
@@ -40,13 +40,13 @@
/**
* indicates whether or not this PrintWriter has incurred an error.
*/
- boolean ioError;
+ private boolean ioError;
/**
* indicates whether or not this PrintWriter should flush its contents after
* printing a new line.
*/
- boolean autoflush;
+ private boolean autoflush;
private final String lineSeparator = AccessController
.doPrivileged(new PriviAction<String>("line.separator")); //$NON-NLS-1$
@@ -215,7 +215,8 @@
* <code>true</code>.
*
*/
- public void close() {
+ @Override
+ public void close() {
synchronized (lock) {
if (out != null) {
try {
@@ -233,7 +234,8 @@
* target Writer. This implementation flushes the target writer. If an error
* occurs, set an error in this PrintWriter to <code>true</code>.
*/
- public void flush() {
+ @Override
+ public void flush() {
synchronized (lock) {
if (out != null) {
try {
@@ -603,7 +605,8 @@
* @param buf
* the non-null array containing characters to write.
*/
- public void write(char buf[]) {
+ @Override
+ public void write(char buf[]) {
write(buf, 0, buf.length);
}
@@ -618,7 +621,8 @@
*
* @throws ArrayIndexOutOfBoundsException If offset or count are outside of bounds.
*/
- public void write(char buf[], int offset, int count) {
+ @Override
+ public void write(char buf[], int offset, int count) {
doWrite(buf, offset, count);
}
@@ -629,7 +633,8 @@
* @param oneChar
* The character to write
*/
- public void write(int oneChar) {
+ @Override
+ public void write(int oneChar) {
doWrite(new char[] { (char) oneChar }, 0, 1);
}
@@ -653,7 +658,8 @@
* @param str
* the non-null String containing the characters to write.
*/
- public void write(String str) {
+ @Override
+ public void write(String str) {
write(str.toCharArray());
}
@@ -671,7 +677,8 @@
* @throws ArrayIndexOutOfBoundsException
* If offset or count are outside of bounds.
*/
- public void write(String str, int offset, int count) {
+ @Override
+ public void write(String str, int offset, int count) {
write(str.substring(offset, offset + count).toCharArray());
}
@@ -685,7 +692,8 @@
* The character appended to the PrintWriter.
* @return The PrintWriter.
*/
- public PrintWriter append(char c) {
+ @Override
+ public PrintWriter append(char c) {
write(c);
return this;
}
@@ -701,7 +709,8 @@
* The CharSequence appended to the PrintWriter.
* @return The PrintWriter
*/
- public PrintWriter append(CharSequence csq) {
+ @Override
+ public PrintWriter append(CharSequence csq) {
if (null == csq) {
append(TOKEN_NULL, 0, TOKEN_NULL.length());
} else {
@@ -733,7 +742,8 @@
* If start is less than end, end is greater than the length of
* the CharSequence, or start or end is negative.
*/
- public PrintWriter append(CharSequence csq, int start, int end) {
+ @Override
+ public PrintWriter append(CharSequence csq, int start, int end) {
if (null == csq) {
csq = TOKEN_NULL;
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/SequenceInputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/SequenceInputStream.java?rev=438343&r1=438342&r2=438343&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/SequenceInputStream.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/SequenceInputStream.java Tue Aug 29 21:10:04 2006
@@ -28,12 +28,12 @@
/**
* An enumeration which will return types of InputStream.
*/
- Enumeration<? extends InputStream> e;
+ private Enumeration<? extends InputStream> e;
/**
* The current input stream.
*/
- InputStream in;
+ private InputStream in;
/**
* Constructs a new SequenceInputStream using the two streams
@@ -82,7 +82,8 @@
* @throws IOException
* If an error occurs in this InputStream.
*/
- public int available() throws IOException {
+ @Override
+ public int available() throws IOException {
if (e != null && in != null) {
return in.available();
}
@@ -97,7 +98,8 @@
* @throws IOException
* If an error occurs attempting to close this FileInputStream.
*/
- public void close() throws IOException {
+ @Override
+ public void close() throws IOException {
while (in != null) {
nextStream();
}
@@ -134,7 +136,8 @@
* @throws IOException
* If an error occurs while reading the stream
*/
- public int read() throws IOException {
+ @Override
+ public int read() throws IOException {
while (in != null) {
int result = in.read();
if (result >= 0) {
@@ -162,7 +165,8 @@
* @throws IOException
* If an error occurs while reading the stream
*/
- public int read(byte[] buffer, int offset, int count) throws IOException {
+ @Override
+ public int read(byte[] buffer, int offset, int count) throws IOException {
if (in == null) {
return -1;
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StreamTokenizer.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StreamTokenizer.java?rev=438343&r1=438342&r2=438343&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StreamTokenizer.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StreamTokenizer.java Tue Aug 29 21:10:04 2006
@@ -96,17 +96,17 @@
private int lineNumber = 1;
- private boolean forceLowercase = false;
+ private boolean forceLowercase;
- private boolean isEOLSignificant = false;
+ private boolean isEOLSignificant;
- private boolean slashStarComments = false;
+ private boolean slashStarComments;
- private boolean slashSlashComments = false;
+ private boolean slashSlashComments;
- private boolean pushBackToken = false;
+ private boolean pushBackToken;
- private boolean lastCr = false;
+ private boolean lastCr;
/* One of these will have the stream */
private InputStream inStream;
@@ -160,12 +160,14 @@
*
* @deprecated Use StreamTokenizer(Reader)
*/
- public StreamTokenizer(InputStream is) {
+ @Deprecated
+ public StreamTokenizer(InputStream is) {
this();
- if (is != null)
- inStream = is;
- else
- throw new NullPointerException();
+ if (is != null) {
+ inStream = is;
+ } else {
+ throw new NullPointerException();
+ }
}
/**
@@ -189,10 +191,11 @@
*/
public StreamTokenizer(Reader r) {
this();
- if (r != null)
- inReader = r;
- else
- throw new NullPointerException();
+ if (r != null) {
+ inReader = r;
+ } else {
+ throw new NullPointerException();
+ }
}
/**
@@ -203,8 +206,9 @@
* The character to be considered a comment character.
*/
public void commentChar(int ch) {
- if (0 <= ch && ch < tokenTypes.length)
- tokenTypes[ch] = TOKEN_COMMENT;
+ if (0 <= ch && ch < tokenTypes.length) {
+ tokenTypes[ch] = TOKEN_COMMENT;
+ }
}
/**
@@ -251,8 +255,9 @@
public int nextToken() throws IOException {
if (pushBackToken) {
pushBackToken = false;
- if (ttype != TT_UNKNOWN)
- return ttype;
+ if (ttype != TT_UNKNOWN) {
+ return ttype;
+ }
}
sval = null; // Always reset sval to null
int currentChar = peekChar == -2 ? read() : peekChar;
@@ -261,8 +266,9 @@
lastCr = false;
currentChar = read();
}
- if (currentChar == -1)
- return (ttype = TT_EOF);
+ if (currentChar == -1) {
+ return (ttype = TT_EOF);
+ }
byte currentType = currentChar > 255 ? TOKEN_WORD
: tokenTypes[currentChar];
@@ -277,8 +283,9 @@
peekChar = -2;
return (ttype = TT_EOL);
}
- if ((currentChar = read()) == '\n')
- currentChar = read();
+ if ((currentChar = read()) == '\n') {
+ currentChar = read();
+ }
} else if (currentChar == '\n') {
lineNumber++;
if (isEOLSignificant) {
@@ -290,8 +297,9 @@
// Advance over this white space character and try again.
currentChar = read();
}
- if (currentChar == -1)
- return (ttype = TT_EOF);
+ if (currentChar == -1) {
+ return (ttype = TT_EOF);
+ }
currentType = currentChar > 255 ? TOKEN_WORD
: tokenTypes[currentChar];
}
@@ -304,18 +312,21 @@
StringBuilder digits = new StringBuilder(20);
boolean haveDecimal = false, checkJustNegative = currentChar == '-';
while (true) {
- if (currentChar == '.')
- haveDecimal = true;
+ if (currentChar == '.') {
+ haveDecimal = true;
+ }
digits.append((char) currentChar);
currentChar = read();
if ((currentChar < '0' || currentChar > '9')
- && (haveDecimal || currentChar != '.'))
- break;
+ && (haveDecimal || currentChar != '.')) {
+ break;
+ }
}
peekChar = currentChar;
- if (checkJustNegative && digits.length() == 1)
- // Didn't get any other digits other than '-'
+ if (checkJustNegative && digits.length() == 1) {
+ // Didn't get any other digits other than '-'
return (ttype = '-');
+ }
try {
nval = Double.valueOf(digits.toString()).doubleValue();
} catch (NumberFormatException e) {
@@ -331,8 +342,9 @@
word.append((char) currentChar);
currentChar = read();
if (currentChar == -1
- || (currentChar < 256 && (tokenTypes[currentChar] & (TOKEN_WORD | TOKEN_DIGIT)) == 0))
- break;
+ || (currentChar < 256 && (tokenTypes[currentChar] & (TOKEN_WORD | TOKEN_DIGIT)) == 0)) {
+ break;
+ }
}
peekChar = currentChar;
sval = forceLowercase ? word.toString().toLowerCase() : word
@@ -359,10 +371,11 @@
digitValue = digitValue * 8 + (c1 - '0');
c1 = read();
// limit the digit value to a byte
- if (digitValue > 037 || c1 > '7' || c1 < '0')
- readPeek = false;
- else
- digitValue = digitValue * 8 + (c1 - '0');
+ if (digitValue > 037 || c1 > '7' || c1 < '0') {
+ readPeek = false;
+ } else {
+ digitValue = digitValue * 8 + (c1 - '0');
+ }
}
if (!readPeek) {
// We've consumed one to many
@@ -404,8 +417,9 @@
peekOne = read();
}
}
- if (peekOne == matchQuote)
- peekOne = read();
+ if (peekOne == matchQuote) {
+ peekOne = read();
+ }
peekChar = peekOne;
ttype = matchQuote;
sval = quoteString.toString();
@@ -423,8 +437,9 @@
return (ttype = TT_EOF);
}
if (currentChar == '\r') {
- if (peekOne == '\n')
- peekOne = read();
+ if (peekOne == '\n') {
+ peekOne = read();
+ }
lineNumber++;
} else if (currentChar == '\n') {
lineNumber++;
@@ -470,8 +485,9 @@
* The character to be considered an ordinary comment character.
*/
public void ordinaryChar(int ch) {
- if (0 <= ch && ch < tokenTypes.length)
- tokenTypes[ch] = 0;
+ if (0 <= ch && ch < tokenTypes.length) {
+ tokenTypes[ch] = 0;
+ }
}
/**
@@ -484,20 +500,24 @@
* The ending range for ordinary characters.
*/
public void ordinaryChars(int low, int hi) {
- if (low < 0)
- low = 0;
- if (hi > tokenTypes.length)
- hi = tokenTypes.length - 1;
- for (int i = low; i <= hi; i++)
- tokenTypes[i] = 0;
+ if (low < 0) {
+ low = 0;
+ }
+ if (hi > tokenTypes.length) {
+ hi = tokenTypes.length - 1;
+ }
+ for (int i = low; i <= hi; i++) {
+ tokenTypes[i] = 0;
+ }
}
/**
* Indicate that numbers should be parsed.
*/
public void parseNumbers() {
- for (int i = '0'; i <= '9'; i++)
- tokenTypes[i] |= TOKEN_DIGIT;
+ for (int i = '0'; i <= '9'; i++) {
+ tokenTypes[i] |= TOKEN_DIGIT;
+ }
tokenTypes['.'] |= TOKEN_DIGIT;
tokenTypes['-'] |= TOKEN_DIGIT;
}
@@ -517,14 +537,16 @@
* The character to be considered a quote comment character.
*/
public void quoteChar(int ch) {
- if (0 <= ch && ch < tokenTypes.length)
- tokenTypes[ch] = TOKEN_QUOTE;
+ if (0 <= ch && ch < tokenTypes.length) {
+ tokenTypes[ch] = TOKEN_QUOTE;
+ }
}
private int read() throws IOException {
// Call the read for the appropriate stream
- if (inStream == null)
- return inReader.read();
+ if (inStream == null) {
+ return inReader.read();
+ }
return inStream.read();
}
@@ -532,8 +554,9 @@
* Reset all characters so that they are ordinary.
*/
public void resetSyntax() {
- for (int i = 0; i < 256; i++)
- tokenTypes[i] = 0;
+ for (int i = 0; i < 256; i++) {
+ tokenTypes[i] = 0;
+ }
}
/**
@@ -566,7 +589,8 @@
*
* @return The current state of this tokenizer.
*/
- public String toString() {
+ @Override
+ public String toString() {
// Values determined through experimentation
StringBuilder result = new StringBuilder();
result.append("Token["); //$NON-NLS-1$
@@ -605,12 +629,15 @@
* The ending range for whitespace characters.
*/
public void whitespaceChars(int low, int hi) {
- if (low < 0)
- low = 0;
- if (hi > tokenTypes.length)
- hi = tokenTypes.length - 1;
- for (int i = low; i <= hi; i++)
- tokenTypes[i] = TOKEN_WHITE;
+ if (low < 0) {
+ low = 0;
+ }
+ if (hi > tokenTypes.length) {
+ hi = tokenTypes.length - 1;
+ }
+ for (int i = low; i <= hi; i++) {
+ tokenTypes[i] = TOKEN_WHITE;
+ }
}
/**
@@ -623,11 +650,14 @@
* The ending range for word characters.
*/
public void wordChars(int low, int hi) {
- if (low < 0)
- low = 0;
- if (hi > tokenTypes.length)
- hi = tokenTypes.length - 1;
- for (int i = low; i <= hi; i++)
- tokenTypes[i] |= TOKEN_WORD;
+ if (low < 0) {
+ low = 0;
+ }
+ if (hi > tokenTypes.length) {
+ hi = tokenTypes.length - 1;
+ }
+ for (int i = low; i <= hi; i++) {
+ tokenTypes[i] |= TOKEN_WORD;
+ }
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StringBufferInputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StringBufferInputStream.java?rev=438343&r1=438342&r2=438343&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StringBufferInputStream.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StringBufferInputStream.java Tue Aug 29 21:10:04 2006
@@ -22,6 +22,7 @@
*
* @deprecated Use StringReader
*/
+@Deprecated
public class StringBufferInputStream extends InputStream {
/**
* The String containing the data to read.
@@ -48,8 +49,9 @@
if (str != null) {
buffer = str;
count = str.length();
- } else
- throw new NullPointerException();
+ } else {
+ throw new NullPointerException();
+ }
}
/**
@@ -59,7 +61,8 @@
* @return the number of characters available.
*
*/
- public synchronized int available() {
+ @Override
+ public synchronized int available() {
return count - pos;
}
@@ -70,7 +73,8 @@
*
* @return the byte read or -1 if end of stream.
*/
- public synchronized int read() {
+ @Override
+ public synchronized int read() {
return pos < count ? buffer.charAt(pos++) & 0xFF : -1;
}
@@ -88,7 +92,8 @@
* the maximum number of bytes to store in <code>b</code>.
* @return the number of bytes actually read or -1 if end of stream.
*/
- public synchronized int read(byte b[], int offset, int length) {
+ @Override
+ public synchronized int read(byte b[], int offset, int length) {
// According to 22.7.6 should return -1 before checking other
// parameters.
if (pos >= count) {
@@ -103,8 +108,9 @@
}
int copylen = count - pos < length ? count - pos : length;
- for (int i = 0; i < copylen; i++)
- b[offset + i] = (byte) buffer.charAt(pos + i);
+ for (int i = 0; i < copylen; i++) {
+ b[offset + i] = (byte) buffer.charAt(pos + i);
+ }
pos += copylen;
return copylen;
}
@@ -118,7 +124,8 @@
* from this position.
*
*/
- public synchronized void reset() {
+ @Override
+ public synchronized void reset() {
pos = 0;
}
@@ -131,9 +138,11 @@
* the number of characters to skip.
* @return the number of characters actually skipped.
*/
- public synchronized long skip(long n) {
- if (n <= 0)
- return 0;
+ @Override
+ public synchronized long skip(long n) {
+ if (n <= 0) {
+ return 0;
+ }
int numskipped;
if (this.count - pos < n) {
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StringReader.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StringReader.java?rev=438343&r1=438342&r2=438343&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StringReader.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StringReader.java Tue Aug 29 21:10:04 2006
@@ -26,7 +26,7 @@
private int markpos = -1;
- private int pos = 0;
+ private int pos;
private int count;
@@ -49,16 +49,18 @@
* longer read from it. Only the first invocation of this method has any
* effect.
*/
- public void close() {
+ @Override
+ public void close() {
synchronized (lock) {
- if (isOpen())
- str = null;
+ if (isOpen()) {
+ str = null;
+ }
}
}
/**
* Answer a boolean indicating whether or not this StringReader is open.
- * @return str
+ * @return <code>true</code> if open, otherwise <code>false</code>
*/
private boolean isOpen() {
return str != null;
@@ -75,17 +77,20 @@
* @throws IOException
* If an error occurs attempting mark this StringReader.
*/
- public void mark(int readLimit) throws IOException {
+ @Override
+ public void mark(int readLimit) throws IOException {
if (readLimit >= 0) {
synchronized (lock) {
- if (isOpen())
- markpos = pos;
- else
- throw new IOException(org.apache.harmony.luni.util.Msg
+ if (isOpen()) {
+ markpos = pos;
+ } else {
+ throw new IOException(org.apache.harmony.luni.util.Msg
.getString("K0083")); //$NON-NLS-1$
+ }
}
- } else
- throw new IllegalArgumentException();
+ } else {
+ throw new IllegalArgumentException();
+ }
}
/**
@@ -96,7 +101,8 @@
* <code>false</code> otherwise. This implementation always
* returns <code>true</code>.
*/
- public boolean markSupported() {
+ @Override
+ public boolean markSupported() {
return true;
}
@@ -110,7 +116,8 @@
* @throws IOException
* If the StringReader is already closed.
*/
- public int read() throws IOException {
+ @Override
+ public int read() throws IOException {
synchronized (lock) {
if (isOpen()) {
if (pos != count) {
@@ -127,7 +134,8 @@
*
* @see java.io.Reader#read(char[], int, int)
*/
- public int read(char buf[], int offset, int len) throws IOException {
+ @Override
+ public int read(char buf[], int offset, int len) throws IOException {
// avoid int overflow
if (0 <= offset && offset <= buf.length && 0 <= len
&& len <= buf.length - offset) {
@@ -163,10 +171,12 @@
* @throws IOException
* If an IO error occurs.
*/
- public boolean ready() throws IOException {
+ @Override
+ public boolean ready() throws IOException {
synchronized (lock) {
- if (isOpen())
- return true;
+ if (isOpen()) {
+ return true;
+ }
throw new IOException(org.apache.harmony.luni.util.Msg.getString("K0083")); //$NON-NLS-1$
}
}
@@ -180,12 +190,14 @@
* @throws IOException
* If this StringReader has already been closed.
*/
- public void reset() throws IOException {
+ @Override
+ public void reset() throws IOException {
synchronized (lock) {
- if (isOpen())
- pos = markpos != -1 ? markpos : 0;
- else
- throw new IOException(org.apache.harmony.luni.util.Msg.getString("K0083")); //$NON-NLS-1$
+ if (isOpen()) {
+ pos = markpos != -1 ? markpos : 0;
+ } else {
+ throw new IOException(org.apache.harmony.luni.util.Msg.getString("K0083")); //$NON-NLS-1$
+ }
}
}
@@ -194,7 +206,8 @@
*
* @see java.io.Reader#skip(long)
*/
- public long skip(long ns) throws IOException {
+ @Override
+ public long skip(long ns) throws IOException {
synchronized (lock) {
if (isOpen()) {
if (ns <= 0) {
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StringWriter.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StringWriter.java?rev=438343&r1=438342&r2=438343&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StringWriter.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StringWriter.java Tue Aug 29 21:10:04 2006
@@ -49,8 +49,9 @@
if (initialSize >= 0) {
buf = new StringBuffer(initialSize);
lock = buf;
- } else
- throw new IllegalArgumentException();
+ } else {
+ throw new IllegalArgumentException();
+ }
}
/**
@@ -60,7 +61,8 @@
* @throws IOException
* If an IO error occurs closing this StringWriter.
*/
- public void close() throws IOException {
+ @Override
+ public void close() throws IOException {
/*empty*/
}
@@ -68,7 +70,8 @@
* Flush this Writer. This is the concrete implementation required. This
* particular implementation does nothing.
*/
- public void flush() {
+ @Override
+ public void flush() {
/*empty*/
}
@@ -92,7 +95,8 @@
*
* @return this StringWriters current contents as a String.
*/
- public String toString() {
+ @Override
+ public String toString() {
synchronized (lock) {
return buf.toString();
}
@@ -112,7 +116,8 @@
* @throws ArrayIndexOutOfBoundsException
* If offset or count are outside of bounds.
*/
- public void write(char[] cbuf, int offset, int count) {
+ @Override
+ public void write(char[] cbuf, int offset, int count) {
// avoid int overflow
if (0 <= offset && offset <= cbuf.length && 0 <= count
&& count <= cbuf.length - offset) {
@@ -133,7 +138,8 @@
* The character to write
*
*/
- public void write(int oneChar) {
+ @Override
+ public void write(int oneChar) {
synchronized (lock) {
buf.append((char) oneChar);
}
@@ -147,7 +153,8 @@
* the non-null String containing the characters to write.
*
*/
- public void write(String str) {
+ @Override
+ public void write(String str) {
synchronized (lock) {
buf.append(str);
}
@@ -168,7 +175,8 @@
* @throws ArrayIndexOutOfBoundsException
* If offset or count are outside of bounds.
*/
- public void write(String str, int offset, int count) {
+ @Override
+ public void write(String str, int offset, int count) {
String sub = str.substring(offset, offset + count);
synchronized (lock) {
buf.append(sub);
@@ -180,12 +188,12 @@
* StringWriter.append(<code>c</code>) works the same way as
* StringWriter.write(<code>c</code>).
*
- * @override Writer.append
* @param c
* The character appended to the StringWriter.
* @return The StringWriter.
*/
- public StringWriter append(char c) {
+ @Override
+ public StringWriter append(char c) {
write(c);
return this;
}
@@ -196,12 +204,12 @@
* StringWriter.write(<code>csq</code>.toString()). If <code>csq</code>
* is null, then "null" will be substituted for <code>csq</code>.
*
- * @override Writer.append
* @param csq
* The CharSequence appended to the StringWriter.
* @return The StringWriter
*/
- public StringWriter append(CharSequence csq) {
+ @Override
+ public StringWriter append(CharSequence csq) {
if (null == csq) {
append(TOKEN_NULL, 0, TOKEN_NULL.length());
} else {
@@ -218,8 +226,7 @@
* StringWriter.write(<code>csq</code>.subSequence(<code>start</code>,<code>end</code>).toString).If
* <code>csq</code> is null, then "null" will be substituted for
* <code>csq</code>.
- *
- * @override Writer.append
+ * s
* @param csq
* The CharSequence appended to the StringWriter.
* @param start
@@ -233,7 +240,8 @@
* If start is less than end, end is greater than the length of
* the CharSequence, or start or end is negative.
*/
- public StringWriter append(CharSequence csq, int start, int end) {
+ @Override
+ public StringWriter append(CharSequence csq, int start, int end) {
if (null == csq) {
csq = TOKEN_NULL;
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/WriteAbortedException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/WriteAbortedException.java?rev=438343&r1=438342&r2=438343&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/WriteAbortedException.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/WriteAbortedException.java Tue Aug 29 21:10:04 2006
@@ -59,7 +59,8 @@
*
* @return the receiver's message.
*/
- public String getMessage() {
+ @Override
+ public String getMessage() {
String msg = super.getMessage();
if (detail != null) {
msg = msg + "; " + detail.toString(); //$NON-NLS-1$
@@ -72,7 +73,8 @@
*
* @return the receiver's cause.
*/
- public Throwable getCause() {
+ @Override
+ public Throwable getCause() {
return detail;
}
}
|