add ftruncate() syscall
[nestedvm.git] / src / org / ibex / nestedvm / util / Seekable.java
index 51c7a39..cacca0a 100644 (file)
@@ -1,3 +1,7 @@
+// Copyright 2000-2005 the Contributors, as shown in the revision logs.
+// Licensed under the Apache Public Source License 2.0 ("the License").
+// You may not use this file except in compliance with the License.
+
 package org.ibex.nestedvm.util;
 
 import java.io.*;
@@ -9,6 +13,10 @@ public abstract class Seekable {
     public abstract void seek(int pos) throws IOException;
     public abstract void close() throws IOException;
     public abstract int pos() throws IOException;
+
+    public void resize(long length) throws IOException {
+        throw new IOException("resize not implemented for " + getClass());
+    }
     
     public int read() throws IOException {
         byte[] buf = new byte[1];
@@ -79,6 +87,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 static class InputStream extends Seekable {