Add the RandomAccessFile(File file, String mode) constructor

As per the Java API.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin 2013-10-17 14:46:30 -05:00
parent 18f6f7881a
commit 905ddfe613

View File

@ -22,9 +22,16 @@ public class RandomAccessFile {
public RandomAccessFile(String name, String mode)
throws FileNotFoundException
{
file = new File(name);
this(new File(name), mode);
}
public RandomAccessFile(File file, String mode)
throws FileNotFoundException
{
if (file == null) throw new NullPointerException();
if (mode.equals("rw")) allowWrite = true;
else if (! mode.equals("r")) throw new IllegalArgumentException();
this.file = file;
open();
}