⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 channelmanager.java

📁 支持并发访问的B+树
💻 JAVA
字号:
/* * Created on Nov 19, 2004 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */package com.nay0648.ds.bplustree;import java.io.*;import java.nio.channels.*;/** *  * @author nay0648 * * this is used to manage file channle.all file operation to the B+ tree * get the file channel by this class */class ChannelManager{private static final String FILE_OPEN_MODE="rw";//open tree file in rw modeprivate String path;	/**	 * @param path the tree file path	 */	public ChannelManager(String path)	{		this.path=path;	}		/**	 * get a new channel of the tree file	 * @return return null if field	 */	public FileChannel getChannel()	{		FileChannel ch=null;				try		{			ch=(new RandomAccessFile(path,FILE_OPEN_MODE)).getChannel();		}		catch(IOException exc)		{			exc.printStackTrace();		}		return ch;	}		/**	 * recycle a channel	 * @param ch the channel of the tree file	 */	public void recycle(Channel ch)	{		try		{			if(ch.isOpen()) ch.close();		}		catch(IOException exc)		{			exc.printStackTrace();		}	}	/*	public static void main(String[] args)	{}	*/}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -