/** * Returns a BlockFile which represents an open file with the specified file * name. If the file does not exist it will be created. This factory method * allows the type of implementation to be selected. * * @param fileName the name of the file to open. * @param blockSize the size of a block in bytes. * @param ioType The type of access to use on the file, memory mapped or with explicit IO. * @return the open BlockFile. * @throws IOException if an I/O error occurs. */ public static BlockFile openBlockFile( String fileName, int blockSize, IOType ioType ) throws IOException { return openBlockFile(new File(fileName), blockSize, ioType); }
/** * Constructs a ManagedBlockFile with the specified file. * * @param objectPool an objectPool for this thread. * @param file the name of the BlockFile. * @param blockSize the block size in bytes. * @param ioType the type of I/O mechanism to use. * @throws IOException if an I/O error occurs. */ public ManagedBlockFile( ObjectPool objectPool, File file, int blockSize, BlockFile.IOType ioType ) throws IOException { this.file = file; File freeListFile = new File(file + FREELIST_EXT); if (file.exists() != freeListFile.exists()) { logger.error( "ERROR: inconsistency between Block file and Free List file" ); } blockFile = AbstractBlockFile.openBlockFile(file, blockSize, ioType); freeList = FreeList.openFreeList(objectPool, freeListFile); isOpen = true; }
/** * Constructs a FreeList which uses the specified file (if it exists) or * creates a new file (if it doesn't already exist). * * @param objectPool the ObjectPool to use when allocating Blocks. * @param file the file. * @param ioType the IOType to use for the BlockFile. * @throws IOException if an I/O error occurs. */ private FreeList( ObjectPool objectPool, File file, BlockFile.IOType ioType ) throws IOException { this.objectPool = objectPool; objectPool.incRefCount(); this.file = file; blockFile = AbstractBlockFile.openBlockFile(file, BLOCK_SIZE_B, ioType); itemToPhaseSeqMap = IntFile.open(file + INTFILE_EXT); itemToPhaseSeqMap.clear(); }
throws IOException, SimpleXAResourceException { if (metarootFile == null) { metarootFile = AbstractBlockFile.openBlockFile( fileName + ".sp", METAROOT_SIZE * Constants.SIZEOF_LONG, BlockFile.IOType.EXPLICIT
throws IOException, SimpleXAResourceException { if (metarootFile == null) { metarootFile = AbstractBlockFile.openBlockFile( fileName + ".np", METAROOT_SIZE * Constants.SIZEOF_LONG, BlockFile.IOType.EXPLICIT