001: package com.quadcap.sql.file;
002:
003: /* Copyright 1997 - 2003 Quadcap Software. All rights reserved.
004: *
005: * This software is distributed under the Quadcap Free Software License.
006: * This software may be used or modified for any purpose, personal or
007: * commercial. Open Source redistributions are permitted. Commercial
008: * redistribution of larger works derived from, or works which bundle
009: * this software requires a "Commercial Redistribution License"; see
010: * http://www.quadcap.com/purchase.
011: *
012: * Redistributions qualify as "Open Source" under one of the following terms:
013: *
014: * Redistributions are made at no charge beyond the reasonable cost of
015: * materials and delivery.
016: *
017: * Redistributions are accompanied by a copy of the Source Code or by an
018: * irrevocable offer to provide a copy of the Source Code for up to three
019: * years at the cost of materials and delivery. Such redistributions
020: * must allow further use, modification, and redistribution of the Source
021: * Code under substantially the same terms as this license.
022: *
023: * Redistributions of source code must retain the copyright notices as they
024: * appear in each source code file, these license terms, and the
025: * disclaimer/limitation of liability set forth as paragraph 6 below.
026: *
027: * Redistributions in binary form must reproduce this Copyright Notice,
028: * these license terms, and the disclaimer/limitation of liability set
029: * forth as paragraph 6 below, in the documentation and/or other materials
030: * provided with the distribution.
031: *
032: * The Software is provided on an "AS IS" basis. No warranty is
033: * provided that the Software is free of defects, or fit for a
034: * particular purpose.
035: *
036: * Limitation of Liability. Quadcap Software shall not be liable
037: * for any damages suffered by the Licensee or any third party resulting
038: * from use of the Software.
039: */
040:
041: import java.io.File;
042: import java.io.FileDescriptor;
043: import java.io.IOException;
044: import java.io.RandomAccessFile;
045:
046: import java.util.BitSet;
047:
048: import com.quadcap.util.collections.LongIterator;
049: import com.quadcap.util.collections.LongMap;
050:
051: import com.quadcap.util.Debug;
052: import com.quadcap.util.Util;
053:
054: import com.quadcap.sql.Version;
055:
056: /**
057: * The null store, which is part of the memory-only implementation.
058: * @author Stan Bailes
059: */
060: public class NullStore extends BlockStore {
061:
062: public NullStore() {
063: }
064:
065: /**
066: * Initialize a new BlockStore object using the specified file and
067: * blocksize.
068: *
069: * @param file the underlying file.
070: * @param mode "r" for readonly access, otherwise "rw"
071: * @param blocksize the block size to use when creating the file.
072: * @param the synchronization object
073: */
074: public void init(File file, String mode, int blockSize, Object lock)
075: throws IOException {
076: }
077:
078: /**
079: * Read a block into a buffer. If the specified block is beyond the
080: * current end of file, then grow the file
081: *
082: * @param blockNum the number of the block to read.
083: * @param buf the buffer into which the data is read.
084: */
085: public void read(long blockNum, byte[] buf, int off)
086: throws IOException {
087: throw new IOException("NullStore.read()");
088: }
089:
090: /**
091: * Write a block from a buffer into the file.
092: *
093: * @param blockNum the number of the block to write.
094: * @param buf the buffer from which the data is written.
095: * @exception IOException if an I/O error occurs.
096: */
097: public void write(long blockNum, byte[] buf) throws IOException {
098: throw new IOException("NullStore.write()");
099: }
100:
101: /**
102: * Restore a block image
103: */
104: public void restore(long blockNum, byte[] buf, int off)
105: throws IOException {
106: throw new IOException("NullStore.restore()");
107: }
108:
109: public void setLength(long length) throws IOException {
110: }
111:
112: public boolean isEncrypted() {
113: return false;
114: }
115:
116: public void close() throws IOException {
117: }
118:
119: public void flush() throws IOException {
120: }
121: }
|