001: // kelondroRA.java
002: // -----------------------
003: // part of The Kelondro Database
004: // (C) by Michael Peter Christen; mc@anomic.de
005: // first published on http://www.anomic.de
006: // Frankfurt, Germany, 2004
007: // last major change: 09.02.2004
008: //
009: // This program is free software; you can redistribute it and/or modify
010: // it under the terms of the GNU General Public License as published by
011: // the Free Software Foundation; either version 2 of the License, or
012: // (at your option) any later version.
013: //
014: // This program is distributed in the hope that it will be useful,
015: // but WITHOUT ANY WARRANTY; without even the implied warranty of
016: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
017: // GNU General Public License for more details.
018: //
019: // You should have received a copy of the GNU General Public License
020: // along with this program; if not, write to the Free Software
021: // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
022: //
023: // Using this software in any meaning (reading, learning, copying, compiling,
024: // running) means that you agree that the Author(s) is (are) not responsible
025: // for cost, loss of data or any harm that may be caused directly or indirectly
026: // by usage of this softare or this documentation. The usage of this software
027: // is on your own risk. The installation and usage (starting/running) of this
028: // software may allow other people or application to access your computer and
029: // any attached devices and is highly dependent on the configuration of the
030: // software which must be done by the user of the software; the author(s) is
031: // (are) also not responsible for proper configuration and usage of the
032: // software, even if provoked by documentation provided together with
033: // the software.
034: //
035: // Any changes to this file according to the GPL as documented in the file
036: // gpl.txt aside this file in the shipment you received can be done to the
037: // lines that follows this copyright notice here, but changes must not be
038: // done inside the copyright notive above. A re-distribution must contain
039: // the intact and unchanged copyright notice.
040: // Contributions and changes to the program code must be marked as such.
041:
042: /*
043: The random access interface for the kelondro database.
044: kelondro stores data always through the kelondroRecords class,
045: which in turn also needs a random access file or similar
046: to store the database structure. To provide more than
047: ony file - random-access, we need an abstract interface.
048: */
049:
050: package de.anomic.kelondro;
051:
052: import java.io.IOException;
053: import java.util.HashMap;
054: import java.util.Map;
055:
056: public interface kelondroRA {
057:
058: // logging support
059: public String name();
060:
061: // pseudo-native methods:
062: public long length() throws IOException;
063:
064: public long available() throws IOException;
065:
066: public int read() throws IOException;
067:
068: public void write(int b) throws IOException;
069:
070: public int read(byte[] b, int off, int len) throws IOException;
071:
072: public void write(byte[] b, int off, int len) throws IOException;
073:
074: public void seek(long pos) throws IOException;
075:
076: public void close() throws IOException;
077:
078: // derived methods:
079: public void readFully(byte[] b, int off, int len)
080: throws IOException;
081:
082: public byte[] readFully() throws IOException;
083:
084: public byte readByte() throws IOException;
085:
086: public void writeByte(int v) throws IOException;
087:
088: public short readShort() throws IOException;
089:
090: public void writeShort(int v) throws IOException;
091:
092: public int readInt() throws IOException;
093:
094: public void writeInt(int v) throws IOException;
095:
096: public long readLong() throws IOException;
097:
098: public void writeLong(long v) throws IOException;
099:
100: public void write(byte[] b) throws IOException;
101:
102: public void writeLine(String line) throws IOException;
103:
104: public String readLine() throws IOException;
105:
106: public void writeMap(Map<String, String> props, String comment)
107: throws IOException;
108:
109: public HashMap<String, String> readMap() throws IOException;
110:
111: public void writeArray(byte[] b) throws IOException;
112:
113: public byte[] readArray() throws IOException;
114: }
|