X-Git-Url: http://git.megacz.com/?p=nestedvm.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fnestedvm%2Futil%2FSeekable.java;fp=src%2Forg%2Fibex%2Fnestedvm%2Futil%2FSeekable.java;h=9da8d27c942c9594c7e5befc961666c841381cd5;hp=d49df6658bd9f920e592bc47f20ae4b06d28e62e;hb=00e7b2dcbcd8d28f3e84954704f874a721dd15d3;hpb=65b8c8020c9ede094f08d33157cfb8abdaa546f1 diff --git a/src/org/ibex/nestedvm/util/Seekable.java b/src/org/ibex/nestedvm/util/Seekable.java index d49df66..9da8d27 100644 --- a/src/org/ibex/nestedvm/util/Seekable.java +++ b/src/org/ibex/nestedvm/util/Seekable.java @@ -84,7 +84,8 @@ public abstract class Seekable { public File(java.io.File file, boolean writable, boolean truncate) throws IOException { this.file = file; String mode = writable ? "rw" : "r"; - raf = truncate ? Platform.truncatedRandomAccessFile(file,mode) : new RandomAccessFile(file,mode); + raf = new RandomAccessFile(file,mode); + if (truncate) Platform.setFileLength(raf, 0); } public int read(byte[] buf, int offset, int length) throws IOException { return raf.read(buf,offset,length); } @@ -93,7 +94,7 @@ public abstract class Seekable { public int pos() throws IOException { return (int) raf.getFilePointer(); } public int length() throws IOException { return (int)raf.length(); } public void close() throws IOException { raf.close(); } - public void resize(long length) throws IOException { raf.setLength(length); } + public void resize(long length) throws IOException { Platform.setFileLength(raf, (int)length); } public boolean equals(Object o) { return o != null && o instanceof File && file.equals(((File)o).file);