You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/10/08 09:06:26 UTC
svn commit: r823072 - in /commons/sandbox/runtime/trunk/src:
main/java/org/apache/commons/runtime/io/FileInstance.java
main/java/org/apache/commons/runtime/io/RandomAccessFile.java
test/org/apache/commons/runtime/TestFileSys.java
Author: mturk
Date: Thu Oct 8 07:06:26 2009
New Revision: 823072
URL: http://svn.apache.org/viewvc?rev=823072&view=rev
Log:
Rename RandomAccessFile to FileInstance. It's not just java.io.RandomAccessFile replacement
Added:
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileInstance.java
- copied, changed from r821909, commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/RandomAccessFile.java
Removed:
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/RandomAccessFile.java
Modified:
commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestFileSys.java
Copied: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileInstance.java (from r821909, commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/RandomAccessFile.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileInstance.java?p2=commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileInstance.java&p1=commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/RandomAccessFile.java&r1=821909&r2=823072&rev=823072&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/RandomAccessFile.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/io/FileInstance.java Thu Oct 8 07:06:26 2009
@@ -37,7 +37,7 @@
* position of the next read or write operation can be moved forwards and
* backwards after every operation.
*/
-public class RandomAccessFile implements Closeable, Flushable
+public class FileInstance implements Closeable, Flushable
{
/* File's descriptor object
*/
@@ -103,7 +103,7 @@
fd.sync();
}
- public RandomAccessFile(File file, EnumSet<FileOpenMode> mode)
+ public FileInstance(File file, EnumSet<FileOpenMode> mode)
throws FileNotFoundException, IOException, IllegalArgumentException,
SecurityException
{
@@ -114,8 +114,8 @@
}
}
- public RandomAccessFile(File file, EnumSet<FileOpenMode> mode,
- EnumSet<FileProtection> prot)
+ public FileInstance(File file, EnumSet<FileOpenMode> mode,
+ EnumSet<FileProtection> prot)
throws FileNotFoundException, IOException, IllegalArgumentException,
SecurityException
{
@@ -128,7 +128,7 @@
/** Create new random access file object from the {@code fd}.
*/
- public RandomAccessFile(Descriptor fd)
+ public FileInstance(Descriptor fd)
{
this.fd = fd;
}
Modified: commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestFileSys.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestFileSys.java?rev=823072&r1=823071&r2=823072&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestFileSys.java (original)
+++ commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestFileSys.java Thu Oct 8 07:06:26 2009
@@ -47,9 +47,9 @@
throws Exception
{
File file = new File("ftest1.txt");
- RandomAccessFile f = new RandomAccessFile(file, EnumSet.of(FileOpenMode.RDWR, FileOpenMode.CREATE));
+ FileInstance f = new FileInstance(file, EnumSet.of(FileOpenMode.RDWR, FileOpenMode.CREATE));
- assertFalse("RandomAccessFile", f == null);
+ assertFalse("FileInstance", f == null);
System.out.println();
f.close();
}
@@ -59,8 +59,8 @@
{
File file = new File("ftest1.txt");
try {
- RandomAccessFile f = new RandomAccessFile(file, EnumSet.of(FileOpenMode.RDWR, FileOpenMode.CREATE, FileOpenMode.EXCL));
- assertFalse("RandomAccessFile", f != null);
+ FileInstance f = new FileInstance(file, EnumSet.of(FileOpenMode.RDWR, FileOpenMode.CREATE, FileOpenMode.EXCL));
+ assertFalse("FileInstance", f != null);
f.close();
}
catch (FileNotFoundException fe) {
@@ -76,8 +76,8 @@
{
File file = new File("ftest1.txt");
file.delete();
- RandomAccessFile f = new RandomAccessFile(file, EnumSet.of(FileOpenMode.RDWR, FileOpenMode.CREATE, FileOpenMode.EXCL));
- assertFalse("RandomAccessFile", f == null);
+ FileInstance f = new FileInstance(file, EnumSet.of(FileOpenMode.RDWR, FileOpenMode.CREATE, FileOpenMode.EXCL));
+ assertFalse("FileInstance", f == null);
f.close();
file.delete();
}
@@ -110,8 +110,8 @@
File file = new File("ftest1.rnd");
makeRandomFile(file.getPath(), 1024 * 128);
- RandomAccessFile f = new RandomAccessFile(file, EnumSet.of(FileOpenMode.READ, FileOpenMode.NONBLOCK));
- assertFalse("RandomAccessFile", f == null);
+ FileInstance f = new FileInstance(file, EnumSet.of(FileOpenMode.READ, FileOpenMode.NONBLOCK));
+ assertFalse("FileInstance", f == null);
byte [] buf = new byte[1024 * 128];
int rd = f.read(buf, 0, buf.length);