亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? recordstore.java

?? 有關j2me的很好的例子可以研究一下
?? JAVA
?? 第 1 頁 / 共 5 頁
字號:
    }    /**     * Returns all of the recordId's currently in the record store.     *     * MUST be called after obtaining rsLock, e.g in a      * <code>synchronized (rsLock) {</code> block.     *     * @return an array of the recordId's currently in the record store     *         or null if the record store is closed.     */    int[] getRecordIDs()     {	if (dbraf == null) // lower overhead than checkOpen() 	    return null;	int index = 0;	int[] tmp = new int[dbNumLiveRecords];	int offset = dbFirstRecordOffset; // start at beginning of file	RecordHeader rh = new RecordHeader(); 	try {	    while (offset != 0) {		rh.load(offset);		if (rh.id > 0) {		    tmp[index++] = rh.id;		}		offset = rh.nextOffset;	    }	} catch (java.io.IOException ioe) {	    return null;	}	return tmp;    }    /**     * Remove free blocks from the record store and compact records     * with data into as small a space in <code>rsFile</code> as     * possible.  Operates from smallest to greatest offset in      * <code>rsFile</code>, copying data in chunks towards the      * beginning of the file, and updating record store meta-data     * as it progresses.     *     * Warning: This is a slow operation that scales linearly     * with rsFile size.       *     * @exception RecordStoreNotOpenException if this record store      *            is closed     * @exception RecordStoreException if an error occurs during record      *            store compaction     */    private void compactRecords() throws RecordStoreNotOpenException, 	RecordStoreException {	int offset = dbDataStart;  // after record store header structure	int target = 0;	int bytesLeft;	int numToMove;	byte[] chunkBuffer = new byte[DB_COMPACTBUFFER_SIZE];		RecordHeader rh = new RecordHeader();		int prevRec = 0;	while (offset < dbDataEnd) {	    try {		rh.load(offset);	    } catch (java.io.IOException ioe) {		// NOTE - should throw some exception here		System.out.println("Unexpected IOException in CompactRS!");	    }	    	    if (rh.id == -1) {          // a free block		if (target == 0) {		    target = offset; 		} // else skip free block		offset += rh.blockSize;	    } else {                    // a record block		if (target == 0) {		    // No move needed so far.		    prevRec = offset;		    offset += rh.blockSize;		} else {		    int old_offset = target;		    // Move a record back in the file		    rh.offset = target;		    rh.nextOffset = prevRec;		    try {			rh.store();			offset += DB_RECORD_HEADER_LENGTH;			target += DB_RECORD_HEADER_LENGTH;			bytesLeft = (rh.blockSize - DB_RECORD_HEADER_LENGTH);			while (bytesLeft > 0) {			    if (bytesLeft < DB_COMPACTBUFFER_SIZE) {				numToMove = bytesLeft;			    } else {				numToMove = DB_COMPACTBUFFER_SIZE;			    }			    dbraf.seek(offset);			    dbraf.read(chunkBuffer, 0, numToMove);			    dbraf.seek(target);			    dbraf.write(chunkBuffer, 0, numToMove);			    offset += numToMove;			    target += numToMove;			    bytesLeft -= numToMove;			} 		    } catch (java.io.IOException ioe) {			// NOTE - should throw some exception here			System.out.println("Unexpected IOException " +					   "in CompactRS!");		    }		    prevRec = old_offset;		}	    }	}	if (rh.offset != 0)	    dbDataEnd = rh.offset + rh.blockSize;	dbFirstRecordOffset = rh.offset;	dbFirstFreeBlockOffset = 0;	storeDBState();    }    /*     * Internal Classes       */    /**     * A class representing a RecordHeader, which may be the start of a      * record block or a free block.  (In a free block, only the      * <code> NextOffset </code> and <code> BlockSize </code> fields     * are valid.)  Currently it is a conveinience structure, with     * fields visible and directly modifyable by the enclosing     * RecordStore class.     */    private class RecordHeader {	/*	 * Each record is laid out in the file system as follows:	 * Bytes - Usage	 * 00-03 - Record ID	 * 04-07 - Next record offset	 * 08-11 - Record size...total (in bytes, big endian).	 * 12-15 - Length of Data.  This is stored separately for the case 	 *         where a record has gotten smaller.	 * 16-xx - Data	 *	 * Each free block is laid out in the file system as follows:	 * Bytes - Usage	 * 00-03 - Free block ID (set to -1)	 * 04-07 - Next record offset (not used by free block)	 * 08-11 - Free block size in bytes (in bytes, big endian)	 * 12-15 - Next free block offset (zero if this is the last free block)	 * 16-xx - Data (not used by free block)	 */	/** REC_ID offset */	private static final int REC_ID = 0;	/** NEXT_OFFSET offset */	private static final int NEXT_OFFSET = 4;	/** BLOCK_SIZE offset */	private static final int BLOCK_SIZE = 8;	/** 	 * data length offset of record block or next free block 	 * offset of free block 	 */	private static final int DATALEN_OR_NEXTFREE = 12;	/** DATA_OFFSET offset (offset to record data) */	private static final int DATA_OFFSET = 16; 		/** offset of the record block or free block in RSFile */	int offset;	/** record id -or- -1 if free block */	int id;	/** next record offset */	int nextOffset;	/** record size -or- free block size */	int blockSize;  	/** record length -or- next free block offset */	int dataLenOrNextFree;		/**	 * default RecordHeader constructor - creates an empty header	 */	RecordHeader() { }		/**	 * Creates a new RecordHeader and initializes it with data	 * read from a RecordStoreFile at offset <code> offset </code>.	 *	 * @param _offset seek offset in RecordStoreFile of desired 	 *        RecordHeader.	 *	 * @exception IOException if there is an error reading the	 *            underlying RecordStoreFile.	 */	RecordHeader(int _offset) throws java.io.IOException {	    load(_offset);	}	/**	 * Creates a new RecordHeader and initializes it with data 	 * provided in the parameters.  This RecordHeader will not	 * be stored (on disk/in persistant storage) until the 	 * <code> store </code> method is called.	 *	 * @param _offset offset in RecordStoreFile where this 	 *        RecordHeader should be stored.	 * @param _id record id of this new RecordHeader	 *	 * @param next_offset next RecordHeader in linked list of	 *        records.	 * @param size total size of the storage block allocated for	 *        this record or free block.	 * @param len_or_free length of data in this record (may be shorter	 *        than <code>size</code> -or- next free block if this	 *        header is a free block header	 */	RecordHeader(int _offset, int _id, int next_offset, 		     int size, int len_or_free) {	    offset = _offset;	    id = _id;	    nextOffset = next_offset;	    blockSize = size;	    dataLenOrNextFree = len_or_free;	}	/**	 * Re-uses a RecordHeader and initializes it with data	 * read from a RecordStoreFile at offset <code> offset </code>.	 *	 * @param _offset seek offset in RecordStoreFile of desired 	 *        RecordHeader.	 *	 * @exception IOException if there is an error reading the	 *            underlying RecordStoreFile	 */		void load(int _offset) throws java.io.IOException {	    offset = _offset;	    	    // read rec header from file.	    dbraf.seek(offset);	    dbraf.read(recHeadBuf, 0, DB_RECORD_HEADER_LENGTH);	    	    id = RecordStore.getInt(recHeadBuf, REC_ID);	    nextOffset = RecordStore.getInt(recHeadBuf, NEXT_OFFSET);	    blockSize = RecordStore.getInt(recHeadBuf, BLOCK_SIZE);	    dataLenOrNextFree = RecordStore.getInt(recHeadBuf, 					       DATALEN_OR_NEXTFREE);	}		/**	 * Flushes an in memory RecordHeader instance to storage in a 	 * a RecordStoreFile at <code>offset</code>.	 * @exception IOException if there is an error writing the	 *            underlying RecordStoreFile	 */		void store() throws java.io.IOException {	    RecordStore.putInt(id, recHeadBuf, REC_ID);	    RecordStore.putInt(nextOffset, recHeadBuf, NEXT_OFFSET);	    RecordStore.putInt(blockSize, recHeadBuf, BLOCK_SIZE);	    RecordStore.putInt(dataLenOrNextFree, recHeadBuf, 			       DATALEN_OR_NEXTFREE);	    	    // write record header;	    dbraf.seek(offset);	    dbraf.write(recHeadBuf, 0, DB_RECORD_HEADER_LENGTH);	}	/**	 * Reads data associated with this record from storage (a	 * RecordStoreFile) at <code>offset</code>.	 *	 * Assumes CALLER has ensured <code>dataLenOrNextFree</code> is set 	 * correctly, and that <code>dataLenOrNextFree</code> bytes will 	 * fit into the array.	 *	 * @param buf data is read into this buffer.	 * @param _offset position in <code>buf</code> to start reading	 *        data into.	 *	 * @return number of bytes read.	 *	 * @exception IOException if there is an error reading the	 *            underlying RecordStoreFile	 */		int read(byte[] buf, int _offset) throws java.io.IOException {	    dbraf.seek(offset + DATA_OFFSET);	    return dbraf.read(buf, _offset, dataLenOrNextFree);	}	/**	 * Writes data associated with this record to storage (a 	 * RecordStoreFile) at <code>offset</code>.	 *	 * Assumes CALLER has ensured <code>dataLenOrNextFree</code> is	 * set correctly.	 *	 * @param buf data to store in this record.	 * @param _offset point in <code>buf</code> to begin write from.	 *	 * @exception IOException if there is an error writing the	 *            underlying RecordStoreFile.	 */		void write(byte[] buf, int _offset) throws java.io.IOException {	    dbraf.seek(offset + DATA_OFFSET);	    dbraf.write(buf, _offset, dataLenOrNextFree);	}    }    /**     * RecordHeaderCache providing a per RecordStore, in memory cache of      * recent  RecordHeader lookups in order to absorb in many cases the     * need to search for records on disk.  Since the on disk data model     * for record storage is a linked list, this can improve performance     * when a record is accessed frequently.       *     * (Currently implemented in a simple, direct mapped way.  Could be     * modified to be random replacement/linear lookup, etc.  These design     * considerations should be determined by measuring cache performance     * on representative RMS use cases.)     */    private class RecordHeaderCache {	/** a cache of RecordHeader objects */	private RecordHeader[] mCache;		/**	 * Returns a new RecordHeaderCache able to hold up to <code>	 * size</code> record headers.	 *	 * @param size max number of RecordHeader objects allowed 	 *        in <code>mCache</code>.	 */	RecordHeaderCache(int size) {	    mCache = new RecordHeader[size];	}		/**	 * Returns a RecordHeader for record <code>rec_id</code> or 	 * null if the desired record header is not in the cache	 *	 * @param rec_id record id of the desired record header.	 *	 * @return a RecordHeader object for record 	 *         <code>rec_id</code>.	 */	RecordHeader get(int rec_id) {	    int idx = rec_id % mCache.length;	    RecordHeader rh = (RecordHeader)mCache[idx];	    if ((mCache[idx] != null) && (mCache[idx].id != rec_id))		return null;	    return rh;	}		/**	 * Inserts a new RecordHeader into the cache.	 *	 * @param rh a RecordHeader to add to the cache.	 */	void insert(RecordHeader rh) {	    int idx = rh.id % mCache.length;	    mCache[idx] = rh;	}		/**	 * Removes a RecordHeader from the cache if it exists,	 * otherwise does nothing.  Used in the case that the	 * cached RecordHeader is no longer valid.	 *	 * @param rec_id the record ID of the RecordHeader to 	 *        invalidate	 */	void invalidate(int rec_id) {	    if (rec_id > 0) {		int idx = rec_id % mCache.length;		if ((mCache[idx] != null) && 		    (mCache[idx].id == rec_id)) {		mCache[idx] = null;		}	    }	}    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品99久久久久久久女警| 亚洲精品欧美综合四区| 一级日本不卡的影视| 久久99精品国产麻豆不卡| 91最新地址在线播放| 日韩欧美亚洲国产另类| 亚洲欧美自拍偷拍色图| 日本aⅴ精品一区二区三区| 色婷婷激情久久| 久久先锋影音av鲁色资源网| 一区二区三区四区高清精品免费观看| 久久激五月天综合精品| 色婷婷av一区二区三区之一色屋| 精品少妇一区二区三区| 亚洲一区在线观看视频| 国产精品一区在线观看你懂的| 欧美偷拍一区二区| 国产欧美久久久精品影院| 偷窥少妇高潮呻吟av久久免费| 成人性生交大合| 555www色欧美视频| 一区二区三区在线影院| 高清在线不卡av| 91精品国产一区二区人妖| 亚洲三级小视频| 国产一区二区三区免费播放| 欧美综合色免费| 国产精品入口麻豆原神| 精品一区二区综合| 欧美日韩国产另类不卡| 亚洲欧美国产高清| 国产专区欧美精品| 欧美精品三级在线观看| 亚洲精品视频免费看| 国产99久久久国产精品潘金| 欧美一区二区三区在线电影| 一区二区久久久| 91在线看国产| 国产精品美女久久久久aⅴ国产馆| 久久精品国产99| 欧美日韩久久一区| 亚洲综合色噜噜狠狠| 99久久国产免费看| 久久精品一区二区三区四区| 韩国女主播成人在线| 日韩一二在线观看| 午夜电影一区二区| 成人高清免费观看| 国产精品网站在线播放| 国产成人免费9x9x人网站视频| 日韩一区二区三区四区| 丝袜亚洲另类欧美综合| 欧美日韩一级视频| 亚洲欧美另类小说视频| 91在线你懂得| 亚洲精品中文在线影院| 99精品视频在线观看| 中文字幕一区免费在线观看 | 欧美日本一道本| 一区二区三区四区中文字幕| 91污片在线观看| 亚洲欧美二区三区| 色狠狠色噜噜噜综合网| 亚洲电影一区二区| 欧美久久高跟鞋激| 捆绑调教一区二区三区| 欧美精品一区二区三区在线播放 | 91麻豆精品国产91久久久资源速度| 一区二区三区四区在线播放| 在线精品视频免费播放| 午夜av电影一区| 欧美一区二区三区视频免费| 日韩中文字幕亚洲一区二区va在线 | av在线这里只有精品| 国产精品日日摸夜夜摸av| 99精品视频在线观看免费| 亚洲精品成人悠悠色影视| 色欧美日韩亚洲| 亚洲已满18点击进入久久| 欧美日韩和欧美的一区二区| 视频在线观看一区| 欧美mv日韩mv国产网站app| 久久99精品国产麻豆婷婷洗澡| ww久久中文字幕| 成人国产精品免费网站| 亚洲欧美日韩久久| 欧美色图免费看| 日本美女视频一区二区| 久久看人人爽人人| 懂色av噜噜一区二区三区av| 亚洲视频一区二区免费在线观看| 99精品桃花视频在线观看| 一区二区高清在线| 欧美一级片在线看| 国产99久久久国产精品免费看| 综合婷婷亚洲小说| 欧美美女一区二区三区| 久久97超碰色| 最新成人av在线| 欧美群妇大交群中文字幕| 黑人精品欧美一区二区蜜桃| 中文字幕字幕中文在线中不卡视频| 欧美曰成人黄网| 久久99这里只有精品| 国产精品视频在线看| 欧美日韩在线直播| 国产酒店精品激情| 亚洲一区二区免费视频| 精品国产露脸精彩对白 | 在线一区二区三区做爰视频网站| 丝袜美腿亚洲一区| 国产精品欧美综合在线| 欧美日韩亚洲国产综合| 国产精品18久久久久久久久| 夜色激情一区二区| 久久综合久久鬼色| 在线观看欧美精品| 国产黄色成人av| 亚洲一级二级三级在线免费观看| 欧美电影免费提供在线观看| 一本色道久久综合狠狠躁的推荐| 久久精品国产一区二区三区免费看| 综合中文字幕亚洲| 欧美r级在线观看| 91九色02白丝porn| 国产大片一区二区| 日韩高清在线一区| 亚洲视频网在线直播| 2020日本不卡一区二区视频| 在线观看av一区二区| 国产精品夜夜爽| 日韩成人免费电影| 成人免费在线视频| 日韩免费视频一区二区| 日本大香伊一区二区三区| 国产黄色精品网站| 免费看日韩精品| 亚洲综合另类小说| 精品免费一区二区三区| 欧美日韩亚洲丝袜制服| 91香蕉国产在线观看软件| 国产成人鲁色资源国产91色综| 日韩有码一区二区三区| 亚洲女爱视频在线| 国产女主播视频一区二区| 欧美一区二区三区白人| 欧美日韩视频在线第一区| av网站一区二区三区| 国产乱码精品一区二区三区忘忧草| 视频在线观看91| 一区二区三区四区不卡视频 | 国产乱码精品1区2区3区| 日韩中文欧美在线| 亚洲一区二区av在线| 国产精品久久免费看| 久久亚洲精华国产精华液| 日韩一区二区高清| 在线观看亚洲一区| 成人免费精品视频| 久久草av在线| 日本欧洲一区二区| 日本成人中文字幕| 日韩一区欧美二区| 日韩综合小视频| 偷拍自拍另类欧美| 亚洲成人免费视| 亚洲综合一区在线| 亚洲一级不卡视频| 亚洲国产cao| 亚洲一区二区三区四区的| 亚洲男帅同性gay1069| 亚洲欧美自拍偷拍| 综合色中文字幕| 亚洲婷婷在线视频| 亚洲黄色性网站| 一区二区三区在线视频观看| 一区二区三区四区av| 亚洲综合在线五月| 亚洲成av人影院| 午夜精品一区二区三区电影天堂 | 欧美日韩久久久久久| 欧美日本精品一区二区三区| 欧美绝品在线观看成人午夜影视| 欧美三区免费完整视频在线观看| 欧美在线免费视屏| 欧美男同性恋视频网站| 欧美一卡在线观看| 精品国产乱码久久久久久影片| 欧美精品一区二区三区蜜臀| 精品蜜桃在线看| 国产精品午夜在线| 亚洲视频在线观看一区| 亚洲综合视频网| 奇米精品一区二区三区在线观看 | 久久久欧美精品sm网站| 国产午夜精品久久| 亚洲欧美国产三级| 天天综合色天天综合色h| 日本 国产 欧美色综合| 国产精品一区二区视频|