01: /*
02: * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
03: * (http://h2database.com/html/license.html).
04: * Initial Developer: H2 Group
05: */
06: package org.h2.store.fs;
07:
08: import java.io.IOException;
09:
10: /**
11: * This interface represents a random access file.
12: */
13: public interface FileObject {
14:
15: /**
16: * Get the length of the file.
17: *
18: * @return the length
19: */
20: long length() throws IOException;
21:
22: /**
23: * Close the file.
24: */
25: void close() throws IOException;
26:
27: /**
28: * Read from the file.
29: * @param b the byte array
30: * @param off the offset
31: * @param len the number of bytes
32: */
33: void readFully(byte[] b, int off, int len) throws IOException;
34:
35: /**
36: * Go to the specified position in the file.
37: *
38: * @param pos the new position
39: */
40: void seek(long pos) throws IOException;
41:
42: /**
43: * Write to the file.
44: *
45: * @param b the byte array
46: * @param off the offset
47: * @param len the number of bytes
48: */
49: void write(byte[] b, int off, int len) throws IOException;
50:
51: /**
52: * Get the file pointer.
53: *
54: * @return the current file pointer
55: */
56: long getFilePointer() throws IOException;
57:
58: /**
59: * Force changes to the physical location.
60: */
61: void sync() throws IOException;
62:
63: /**
64: * Change the length of the file.
65: *
66: * @param newLength the new length
67: */
68: void setFileLength(long newLength) throws IOException;
69:
70: }
|