DataInputStream.java: Reformatted, Replaced < and & with html entitites in documentation.

2003-05-20  Michael Koch  <konqueror@gmx.de>

	* java/io/DataInputStream.java:
	Reformatted, Replaced < and & with html entitites in documentation.
	* java/io/File.java:
	Reformatted.
	* java/io/PrintWriter.java:
	Moved class documentation.

From-SVN: r66992
This commit is contained in:
Michael Koch 2003-05-20 09:13:19 +00:00 committed by Michael Koch
parent c2a40660aa
commit c93aa80414
4 changed files with 166 additions and 146 deletions

View File

@ -1,3 +1,12 @@
2003-05-20 Michael Koch <konqueror@gmx.de>
* java/io/DataInputStream.java:
Reformatted, Replaced < and & with html entitites in documentation.
* java/io/File.java:
Reformatted.
* java/io/PrintWriter.java:
Moved class documentation.
2003-05-20 Michael Koch <konqueror@gmx.de> 2003-05-20 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/ByteBufferImpl.java, * gnu/java/nio/ByteBufferImpl.java,

View File

@ -51,7 +51,7 @@ package java.io;
* @see DataInput * @see DataInput
* *
* @author Warren Levy <warrenl@cygnus.com> * @author Warren Levy <warrenl@cygnus.com>
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn <arenn@urbanophile.com>
* @date October 20, 1998. * @date October 20, 1998.
*/ */
public class DataInputStream extends FilterInputStream implements DataInput public class DataInputStream extends FilterInputStream implements DataInput
@ -62,7 +62,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
boolean ignoreInitialNewline = false; boolean ignoreInitialNewline = false;
// Byte buffer, used to make primitive read calls more efficient. // Byte buffer, used to make primitive read calls more efficient.
byte[] buf = new byte[8]; byte[] buf = new byte [8];
/** /**
* This constructor initializes a new <code>DataInputStream</code> * This constructor initializes a new <code>DataInputStream</code>
@ -70,9 +70,9 @@ public class DataInputStream extends FilterInputStream implements DataInput
* *
* @param in The subordinate <code>InputStream</code> to read from * @param in The subordinate <code>InputStream</code> to read from
*/ */
public DataInputStream(InputStream in) public DataInputStream (InputStream in)
{ {
super(in); super (in);
} }
/** /**
@ -88,9 +88,9 @@ public class DataInputStream extends FilterInputStream implements DataInput
* *
* @exception IOException If an error occurs. * @exception IOException If an error occurs.
*/ */
public final int read(byte[] b) throws IOException public final int read (byte[] b) throws IOException
{ {
return in.read(b, 0, b.length); return in.read (b, 0, b.length);
} }
/** /**
@ -109,9 +109,9 @@ public class DataInputStream extends FilterInputStream implements DataInput
* *
* @exception IOException If an error occurs. * @exception IOException If an error occurs.
*/ */
public final int read(byte[] b, int off, int len) throws IOException public final int read (byte[] b, int off, int len) throws IOException
{ {
return in.read(b, off, len); return in.read (b, off, len);
} }
/** /**
@ -132,9 +132,9 @@ public class DataInputStream extends FilterInputStream implements DataInput
* *
* @see DataOutput#writeBoolean * @see DataOutput#writeBoolean
*/ */
public final boolean readBoolean() throws IOException public final boolean readBoolean () throws IOException
{ {
return convertToBoolean(in.read()); return convertToBoolean (in.read ());
} }
/** /**
@ -152,9 +152,9 @@ public class DataInputStream extends FilterInputStream implements DataInput
* *
* @see DataOutput#writeByte * @see DataOutput#writeByte
*/ */
public final byte readByte() throws IOException public final byte readByte () throws IOException
{ {
return convertToByte(in.read()); return convertToByte (in.read ());
} }
/** /**
@ -169,7 +169,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
* respectively, they will be transformed to a <code>char</code> in * respectively, they will be transformed to a <code>char</code> in
* the following manner: * the following manner:
* <p> * <p>
* <code>(char)(((byte1 & 0xFF) << 8) | (byte2 & 0xFF)</code> * <code>(char)(((byte1 &amp; 0xFF) &lt;&lt; 8) | (byte2 &amp; 0xFF)</code>
* <p> * <p>
* This method can read a <code>char</code> written by an object * This method can read a <code>char</code> written by an object
* implementing the <code>writeChar()</code> method in the * implementing the <code>writeChar()</code> method in the
@ -182,10 +182,10 @@ public class DataInputStream extends FilterInputStream implements DataInput
* *
* @see DataOutput#writeChar * @see DataOutput#writeChar
*/ */
public final char readChar() throws IOException public final char readChar () throws IOException
{ {
readFully (buf, 0, 2); readFully (buf, 0, 2);
return convertToChar(buf); return convertToChar (buf);
} }
/** /**
@ -209,9 +209,9 @@ public class DataInputStream extends FilterInputStream implements DataInput
* @see DataOutput#writeDouble * @see DataOutput#writeDouble
* @see java.lang.Double#longBitsToDouble * @see java.lang.Double#longBitsToDouble
*/ */
public final double readDouble() throws IOException public final double readDouble () throws IOException
{ {
return Double.longBitsToDouble(readLong()); return Double.longBitsToDouble (readLong ());
} }
/** /**
@ -234,9 +234,9 @@ public class DataInputStream extends FilterInputStream implements DataInput
* @see DataOutput#writeFloat * @see DataOutput#writeFloat
* @see java.lang.Float#intBitsToFloat * @see java.lang.Float#intBitsToFloat
*/ */
public final float readFloat() throws IOException public final float readFloat () throws IOException
{ {
return Float.intBitsToFloat(readInt()); return Float.intBitsToFloat (readInt ());
} }
/** /**
@ -253,9 +253,9 @@ public class DataInputStream extends FilterInputStream implements DataInput
* buffer * buffer
* @exception IOException If any other error occurs * @exception IOException If any other error occurs
*/ */
public final void readFully(byte[] b) throws IOException public final void readFully (byte[] b) throws IOException
{ {
readFully(b, 0, b.length); readFully (b, 0, b.length);
} }
/** /**
@ -277,14 +277,14 @@ public class DataInputStream extends FilterInputStream implements DataInput
* buffer * buffer
* @exception IOException If any other error occurs * @exception IOException If any other error occurs
*/ */
public final void readFully(byte[] b, int off, int len) throws IOException public final void readFully (byte[] b, int off, int len) throws IOException
{ {
while (len > 0) while (len > 0)
{ {
// in.read will block until some data is available. // in.read will block until some data is available.
int numread = in.read(b, off, len); int numread = in.read (b, off, len);
if (numread < 0) if (numread < 0)
throw new EOFException(); throw new EOFException ();
len -= numread; len -= numread;
off += numread; off += numread;
} }
@ -301,8 +301,8 @@ public class DataInputStream extends FilterInputStream implements DataInput
* the first four bytes read from the stream, they will be * the first four bytes read from the stream, they will be
* transformed to an <code>int</code> in the following manner: * transformed to an <code>int</code> in the following manner:
* <p> * <p>
* <code>(int)(((byte1 & 0xFF) << 24) + ((byte2 & 0xFF) << 16) + * <code>(int)(((byte1 &amp; 0xFF) &lt;&lt; 24) + ((byte2 &amp; 0xFF) &lt;&lt; 16) +
* ((byte3 & 0xFF)<< 8) + (byte4 & 0xFF)))</code> * ((byte3 &amp; 0xFF)&lt;&lt; 8) + (byte4 &amp; 0xFF)))</code>
* <p> * <p>
* The value returned is in the range of -2147483648 to 2147483647. * The value returned is in the range of -2147483648 to 2147483647.
* <p> * <p>
@ -317,10 +317,10 @@ public class DataInputStream extends FilterInputStream implements DataInput
* *
* @see DataOutput#writeInt * @see DataOutput#writeInt
*/ */
public final int readInt() throws IOException public final int readInt () throws IOException
{ {
readFully (buf, 0, 4); readFully (buf, 0, 4);
return convertToInt(buf); return convertToInt (buf);
} }
/** /**
@ -349,9 +349,9 @@ public class DataInputStream extends FilterInputStream implements DataInput
* *
* @deprecated * @deprecated
*/ */
public final String readLine() throws IOException public final String readLine () throws IOException
{ {
StringBuffer strb = new StringBuffer(); StringBuffer strb = new StringBuffer ();
readloop: while (true) readloop: while (true)
{ {
@ -363,7 +363,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
getnext = false; getnext = false;
c = in.read(); c = in.read();
if (c < 0) // got an EOF if (c < 0) // got an EOF
return strb.length() > 0 ? strb.toString() : null; return strb.length () > 0 ? strb.toString () : null;
ch = (char) c; ch = (char) c;
if ((ch &= 0xFF) == '\n') if ((ch &= 0xFF) == '\n')
// hack to correctly handle '\r\n' sequences // hack to correctly handle '\r\n' sequences
@ -447,10 +447,10 @@ public class DataInputStream extends FilterInputStream implements DataInput
* the first eight bytes read from the stream, they will be * the first eight bytes read from the stream, they will be
* transformed to an <code>long</code> in the following manner: * transformed to an <code>long</code> in the following manner:
* <p> * <p>
* <code>(long)(((byte1 & 0xFF) << 56) + ((byte2 & 0xFF) << 48) + * <code>(long)(((byte1 &amp; 0xFF) &lt;&lt; 56) + ((byte2 &amp; 0xFF) &lt;&lt; 48) +
* ((byte3 & 0xFF) << 40) + ((byte4 & 0xFF) << 32) + * ((byte3 &amp; 0xFF) &lt;&lt; 40) + ((byte4 &amp; 0xFF) &lt;&lt; 32) +
* ((byte5 & 0xFF) << 24) + ((byte6 & 0xFF) << 16) + * ((byte5 &amp; 0xFF) &lt;&lt; 24) + ((byte6 &amp; 0xFF) &lt;&lt; 16) +
* ((byte7 & 0xFF) << 8) + (byte8 & 0xFF))) * ((byte7 &amp; 0xFF) &lt;&lt; 8) + (byte8 &amp; 0xFF)))
* </code> * </code>
* <p> * <p>
* The value returned is in the range of -9223372036854775808 to * The value returned is in the range of -9223372036854775808 to
@ -467,10 +467,10 @@ public class DataInputStream extends FilterInputStream implements DataInput
* *
* @see DataOutput#writeLong * @see DataOutput#writeLong
*/ */
public final long readLong() throws IOException public final long readLong () throws IOException
{ {
readFully (buf, 0, 8); readFully (buf, 0, 8);
return convertToLong(buf); return convertToLong (buf);
} }
/** /**
@ -485,7 +485,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
* respectively, they will be transformed to a <code>short</code>. in * respectively, they will be transformed to a <code>short</code>. in
* the following manner: * the following manner:
* <p> * <p>
* <code>(short)(((byte1 & 0xFF) << 8) | (byte2 & 0xFF))</code> * <code>(short)(((byte1 &amp; 0xFF) &lt;&lt; 8) | (byte2 &amp; 0xFF))</code>
* <p> * <p>
* The value returned is in the range of -32768 to 32767. * The value returned is in the range of -32768 to 32767.
* <p> * <p>
@ -500,10 +500,10 @@ public class DataInputStream extends FilterInputStream implements DataInput
* *
* @see DataOutput#writeShort * @see DataOutput#writeShort
*/ */
public final short readShort() throws IOException public final short readShort () throws IOException
{ {
readFully (buf, 0, 2); readFully (buf, 0, 2);
return convertToShort(buf); return convertToShort (buf);
} }
/** /**
@ -522,9 +522,9 @@ public class DataInputStream extends FilterInputStream implements DataInput
* *
* @see DataOutput#writeByte * @see DataOutput#writeByte
*/ */
public final int readUnsignedByte() throws IOException public final int readUnsignedByte () throws IOException
{ {
return convertToUnsignedByte(in.read()); return convertToUnsignedByte (in.read ());
} }
/** /**
@ -539,7 +539,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
* respectively, they will be transformed to an <code>int</code> in * respectively, they will be transformed to an <code>int</code> in
* the following manner: * the following manner:
* <p> * <p>
* <code>(int)(((byte1 & 0xFF) << 8) + (byte2 & 0xFF))</code> * <code>(int)(((byte1 &amp; 0xFF) &lt;&lt; 8) + (byte2 &amp; 0xFF))</code>
* <p> * <p>
* The value returned is in the range of 0 to 65535. * The value returned is in the range of 0 to 65535.
* <p> * <p>
@ -554,10 +554,10 @@ public class DataInputStream extends FilterInputStream implements DataInput
* *
* @see DataOutput#writeShort * @see DataOutput#writeShort
*/ */
public final int readUnsignedShort() throws IOException public final int readUnsignedShort () throws IOException
{ {
readFully (buf, 0, 2); readFully (buf, 0, 2);
return convertToUnsignedShort(buf); return convertToUnsignedShort (buf);
} }
/** /**
@ -631,9 +631,9 @@ public class DataInputStream extends FilterInputStream implements DataInput
* *
* @see DataOutput#writeUTF * @see DataOutput#writeUTF
*/ */
public final String readUTF() throws IOException public final String readUTF () throws IOException
{ {
return readUTF(this); return readUTF (this);
} }
/** /**
@ -648,18 +648,18 @@ public class DataInputStream extends FilterInputStream implements DataInput
* *
* @see DataInput#readUTF * @see DataInput#readUTF
*/ */
public final static String readUTF(DataInput in) throws IOException public final static String readUTF (DataInput in) throws IOException
{ {
final int UTFlen = in.readUnsignedShort(); final int UTFlen = in.readUnsignedShort ();
byte[] buf = new byte[UTFlen]; byte[] buf = new byte [UTFlen];
// This blocks until the entire string is available rather than // This blocks until the entire string is available rather than
// doing partial processing on the bytes that are available and then // doing partial processing on the bytes that are available and then
// blocking. An advantage of the latter is that Exceptions // blocking. An advantage of the latter is that Exceptions
// could be thrown earlier. The former is a bit cleaner. // could be thrown earlier. The former is a bit cleaner.
in.readFully(buf, 0, UTFlen); in.readFully (buf, 0, UTFlen);
return convertFromUTF(buf); return convertFromUTF (buf);
} }
/** /**
@ -678,13 +678,13 @@ public class DataInputStream extends FilterInputStream implements DataInput
* EOFException. Neither of these appear to be true in the JDK 1.3's * EOFException. Neither of these appear to be true in the JDK 1.3's
* implementation. This tries to implement the actual JDK behaviour. * implementation. This tries to implement the actual JDK behaviour.
*/ */
public final int skipBytes(int n) throws IOException public final int skipBytes (int n) throws IOException
{ {
if (n <= 0) if (n <= 0)
return 0; return 0;
try try
{ {
return (int) in.skip(n); return (int) in.skip (n);
} }
catch (EOFException x) catch (EOFException x)
{ {
@ -693,94 +693,104 @@ public class DataInputStream extends FilterInputStream implements DataInput
return n; return n;
} }
static boolean convertToBoolean(int b) throws EOFException static boolean convertToBoolean (int b) throws EOFException
{ {
if (b < 0) if (b < 0)
throw new EOFException(); throw new EOFException ();
return (b != 0); return (b != 0);
} }
static byte convertToByte(int i) throws EOFException static byte convertToByte (int i) throws EOFException
{ {
if (i < 0) if (i < 0)
throw new EOFException(); throw new EOFException ();
return (byte) i; return (byte) i;
} }
static int convertToUnsignedByte(int i) throws EOFException static int convertToUnsignedByte (int i) throws EOFException
{ {
if (i < 0) if (i < 0)
throw new EOFException(); throw new EOFException ();
return (i & 0xFF); return (i & 0xFF);
} }
static char convertToChar(byte[] buf) static char convertToChar (byte[] buf)
{ {
return (char) ((buf[0] << 8) | (buf[1] & 0xff)); return (char) ((buf [0] << 8)
| (buf [1] & 0xff));
} }
static short convertToShort(byte[] buf) static short convertToShort (byte[] buf)
{ {
return (short) ((buf[0] << 8) | (buf[1] & 0xff)); return (short) ((buf [0] << 8)
| (buf [1] & 0xff));
} }
static int convertToUnsignedShort(byte[] buf) static int convertToUnsignedShort (byte[] buf)
{ {
return (((buf[0] & 0xff) << 8) | (buf[1] & 0xff)); return (((buf [0] & 0xff) << 8)
| (buf [1] & 0xff));
} }
static int convertToInt(byte[] buf) static int convertToInt (byte[] buf)
{ {
return (((buf[0] & 0xff) << 24) | ((buf[1] & 0xff) << 16) | return (((buf [0] & 0xff) << 24)
((buf[2] & 0xff) << 8) | (buf[3] & 0xff)); | ((buf [1] & 0xff) << 16)
| ((buf [2] & 0xff) << 8)
| (buf [3] & 0xff));
} }
static long convertToLong(byte[] buf) static long convertToLong (byte[] buf)
{ {
return (((long)(buf[0] & 0xff) << 56) | return (((long)(buf [0] & 0xff) << 56) |
((long)(buf[1] & 0xff) << 48) | ((long)(buf [1] & 0xff) << 48) |
((long)(buf[2] & 0xff) << 40) | ((long)(buf [2] & 0xff) << 40) |
((long)(buf[3] & 0xff) << 32) | ((long)(buf [3] & 0xff) << 32) |
((long)(buf[4] & 0xff) << 24) | ((long)(buf [4] & 0xff) << 24) |
((long)(buf[5] & 0xff) << 16) | ((long)(buf [5] & 0xff) << 16) |
((long)(buf[6] & 0xff) << 8) | ((long)(buf [6] & 0xff) << 8) |
((long)(buf[7] & 0xff))); ((long)(buf [7] & 0xff)));
} }
static String convertFromUTF(byte[] buf) static String convertFromUTF (byte[] buf)
throws EOFException, UTFDataFormatException throws EOFException, UTFDataFormatException
{ {
// Give StringBuffer an initial estimated size to avoid // Give StringBuffer an initial estimated size to avoid
// enlarge buffer frequently // enlarge buffer frequently
StringBuffer strbuf = new StringBuffer(buf.length/2 + 2); StringBuffer strbuf = new StringBuffer (buf.length / 2 + 2);
for (int i = 0; i < buf.length; ) for (int i = 0; i < buf.length; )
{ {
if ((buf[i] & 0x80) == 0) // bit pattern 0xxxxxxx if ((buf [i] & 0x80) == 0) // bit pattern 0xxxxxxx
strbuf.append((char) (buf[i++] & 0xFF)); strbuf.append ((char) (buf [i++] & 0xFF));
else if ((buf[i] & 0xE0) == 0xC0) // bit pattern 110xxxxx else if ((buf [i] & 0xE0) == 0xC0) // bit pattern 110xxxxx
{ {
if (i + 1 >= buf.length || (buf[i+1] & 0xC0) != 0x80) if (i + 1 >= buf.length
throw new UTFDataFormatException(); || (buf [i + 1] & 0xC0) != 0x80)
throw new UTFDataFormatException ();
strbuf.append((char) (((buf[i++] & 0x1F) << 6) | strbuf.append((char) (((buf [i++] & 0x1F) << 6)
(buf[i++] & 0x3F))); | (buf [i++] & 0x3F)));
} }
else if ((buf[i] & 0xF0) == 0xE0) // bit pattern 1110xxxx else if ((buf [i] & 0xF0) == 0xE0) // bit pattern 1110xxxx
{ {
if (i + 2 >= buf.length || if (i + 2 >= buf.length
(buf[i+1] & 0xC0) != 0x80 || (buf[i+2] & 0xC0) != 0x80) || (buf [i + 1] & 0xC0) != 0x80
throw new UTFDataFormatException(); || (buf [i + 2] & 0xC0) != 0x80)
throw new UTFDataFormatException ();
strbuf.append((char) (((buf[i++] & 0x0F) << 12) | strbuf.append ((char) (((buf [i++] & 0x0F) << 12)
((buf[i++] & 0x3F) << 6) | | ((buf [i++] & 0x3F) << 6)
(buf[i++] & 0x3F))); | (buf [i++] & 0x3F)));
} }
else // must be ((buf[i] & 0xF0) == 0xF0 || (buf[i] & 0xC0) == 0x80) else // must be ((buf [i] & 0xF0) == 0xF0 || (buf [i] & 0xC0) == 0x80)
throw new UTFDataFormatException(); // bit patterns 1111xxxx or throw new UTFDataFormatException (); // bit patterns 1111xxxx or
// 10xxxxxx // 10xxxxxx
} }
return strbuf.toString(); return strbuf.toString ();
} }
} }

View File

@ -151,7 +151,7 @@ public class File implements Serializable, Comparable
*/ */
public boolean canRead () public boolean canRead ()
{ {
checkRead(); checkRead ();
return _access (READ); return _access (READ);
} }
@ -171,7 +171,7 @@ public class File implements Serializable, Comparable
*/ */
public boolean canWrite () public boolean canWrite ()
{ {
checkWrite(); checkWrite ();
return _access (WRITE); return _access (WRITE);
} }
@ -196,7 +196,7 @@ public class File implements Serializable, Comparable
*/ */
public boolean createNewFile() throws IOException public boolean createNewFile() throws IOException
{ {
checkWrite(); checkWrite ();
return performCreate(); return performCreate();
} }
@ -261,7 +261,7 @@ public class File implements Serializable, Comparable
*/ */
public boolean exists () public boolean exists ()
{ {
checkRead(); checkRead ();
return _access (EXISTS); return _access (EXISTS);
} }
@ -637,7 +637,7 @@ public class File implements Serializable, Comparable
*/ */
public boolean isDirectory () public boolean isDirectory ()
{ {
checkRead(); checkRead ();
return _stat (DIRECTORY); return _stat (DIRECTORY);
} }
@ -653,7 +653,7 @@ public class File implements Serializable, Comparable
*/ */
public boolean isFile () public boolean isFile ()
{ {
checkRead(); checkRead ();
return _stat (ISFILE); return _stat (ISFILE);
} }
@ -670,7 +670,7 @@ public class File implements Serializable, Comparable
*/ */
public boolean isHidden () public boolean isHidden ()
{ {
checkRead(); checkRead ();
return _stat (ISHIDDEN); return _stat (ISHIDDEN);
} }
@ -689,7 +689,7 @@ public class File implements Serializable, Comparable
*/ */
public long lastModified () public long lastModified ()
{ {
checkRead(); checkRead ();
return attr (MODIFIED); return attr (MODIFIED);
} }
@ -703,7 +703,7 @@ public class File implements Serializable, Comparable
*/ */
public long length () public long length ()
{ {
checkRead(); checkRead ();
return attr (LENGTH); return attr (LENGTH);
} }
@ -745,7 +745,7 @@ public class File implements Serializable, Comparable
*/ */
public String[] list (FilenameFilter filter) public String[] list (FilenameFilter filter)
{ {
checkRead(); checkRead ();
return (String[]) performList (filter, null, String.class); return (String[]) performList (filter, null, String.class);
} }
@ -769,7 +769,7 @@ public class File implements Serializable, Comparable
*/ */
public String[] list () public String[] list ()
{ {
checkRead(); checkRead ();
return (String[]) performList (null, null, String.class); return (String[]) performList (null, null, String.class);
} }
@ -793,7 +793,7 @@ public class File implements Serializable, Comparable
*/ */
public File[] listFiles () public File[] listFiles ()
{ {
checkRead(); checkRead ();
return (File[]) performList (null, null, File.class); return (File[]) performList (null, null, File.class);
} }
@ -823,7 +823,7 @@ public class File implements Serializable, Comparable
*/ */
public File[] listFiles (FilenameFilter filter) public File[] listFiles (FilenameFilter filter)
{ {
checkRead(); checkRead ();
return (File[]) performList (filter, null, File.class); return (File[]) performList (filter, null, File.class);
} }
@ -853,7 +853,7 @@ public class File implements Serializable, Comparable
*/ */
public File[] listFiles (FileFilter filter) public File[] listFiles (FileFilter filter)
{ {
checkRead(); checkRead ();
return (File[]) performList (null, filter, File.class); return (File[]) performList (null, filter, File.class);
} }
@ -905,7 +905,7 @@ public class File implements Serializable, Comparable
*/ */
public boolean mkdir () public boolean mkdir ()
{ {
checkWrite(); checkWrite ();
return performMkdir (); return performMkdir ();
} }
@ -936,7 +936,7 @@ public class File implements Serializable, Comparable
*/ */
public boolean mkdirs () public boolean mkdirs ()
{ {
checkWrite(); checkWrite ();
if (isDirectory ()) if (isDirectory ())
return false; return false;
return mkdirs (new File (path)); return mkdirs (new File (path));
@ -987,20 +987,21 @@ public class File implements Serializable, Comparable
String dirname = tmpdir; String dirname = tmpdir;
if (dirname == null) if (dirname == null)
throw throw
new IOException("Cannot determine system temporary directory"); new IOException ("Cannot determine system temporary directory");
directory = new File(dirname); directory = new File (dirname);
if (!directory.exists()) if (!directory.exists ())
throw new IOException("System temporary directory " throw new IOException ("System temporary directory "
+ directory.getName() + " does not exist."); + directory.getName() + " does not exist.");
if (!directory.isDirectory()) if (!directory.isDirectory())
throw new IOException("System temporary directory " throw new IOException ("System temporary directory "
+ directory.getName() + directory.getName()
+ " is not really a directory."); + " is not really a directory.");
} }
if (prefix.length () < 3) if (prefix.length () < 3)
throw new IllegalArgumentException ("Prefix too short: " + prefix); throw new IllegalArgumentException ("Prefix too short: " + prefix);
if (suffix == null) if (suffix == null)
suffix = ".tmp"; suffix = ".tmp";
@ -1059,7 +1060,7 @@ public class File implements Serializable, Comparable
*/ */
public boolean setReadOnly () public boolean setReadOnly ()
{ {
checkWrite(); checkWrite ();
return performSetReadOnly(); return performSetReadOnly();
} }
@ -1089,7 +1090,7 @@ public class File implements Serializable, Comparable
{ {
try try
{ {
s.checkRead(roots[i].path); s.checkRead (roots[i].path);
} }
catch (SecurityException sx) catch (SecurityException sx)
{ {
@ -1220,8 +1221,8 @@ public class File implements Serializable, Comparable
String dname = dest.getName(); String dname = dest.getName();
if (s != null) if (s != null)
{ {
s.checkWrite(sname); s.checkWrite (sname);
s.checkWrite(dname); s.checkWrite (dname);
} }
return performRenameTo (dest); return performRenameTo (dest);
} }
@ -1249,7 +1250,7 @@ public class File implements Serializable, Comparable
*/ */
public boolean setLastModified (long time) public boolean setLastModified (long time)
{ {
checkWrite(); checkWrite ();
return performSetLastModified(time); return performSetLastModified(time);
} }
@ -1272,11 +1273,11 @@ public class File implements Serializable, Comparable
} }
/** /**
* Add this File to the set of files to be deleted upon normal * Add this File to the set of files to be deleted upon normal
* termination. * termination.
* *
* @since 1.2 * @since 1.2
*/ */
// FIXME: This should use the ShutdownHook API once we implement that. // FIXME: This should use the ShutdownHook API once we implement that.
public void deleteOnExit () public void deleteOnExit ()
{ {

View File

@ -37,27 +37,27 @@ exception statement from your version. */
package java.io; package java.io;
/**
* This class prints Java primitive values and objects to a stream as
* text. None of the methods in this class throw an exception. However,
* errors can be detected by calling the <code>checkError()</code> method.
* Additionally, this stream can be designated as "autoflush" when
* created so that any writes are automatically flushed to the underlying
* output sink whenever one of the <code>println</code> methods is
* called. (Note that this differs from the <code>PrintStream</code>
* class which also auto-flushes when it encounters a newline character
* in the chars written).
*
* @author Per Bothner <bothner@cygnus.com>
* @author Aaron M. Renn (arenn@urbanophile.com)
* @date April 17, 1998.
*/
/* Written using "Java Class Libraries", 2nd edition, plus online /* Written using "Java Class Libraries", 2nd edition, plus online
* API docs for JDK 1.2 beta from http://www.javasoft.com. * API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Believed complete and correct. * Status: Believed complete and correct.
* However, should use native methods for conversion. * However, should use native methods for conversion.
*/ */
/**
* This class prints Java primitive values and objects to a stream as
* text. None of the methods in this class throw an exception. However,
* errors can be detected by calling the <code>checkError()</code> method.
* Additionally, this stream can be designated as "autoflush" when
* created so that any writes are automatically flushed to the underlying
* output sink whenever one of the <code>println</code> methods is
* called. (Note that this differs from the <code>PrintStream</code>
* class which also auto-flushes when it encounters a newline character
* in the chars written).
*
* @author Per Bothner <bothner@cygnus.com>
* @author Aaron M. Renn <arenn@urbanophile.com>
* @date April 17, 1998.
*/
public class PrintWriter extends Writer public class PrintWriter extends Writer
{ {
/** /**