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

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

?? memorymappedfile.java

?? java的共享內存管理.基于MMF設計。封裝了java.nio.MappedByteBuffer.在大流量實時業務系統時
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
	 * @throws MemoryNotMappedException
	 *             If the file not mapped into memory
	 * @throws MemoryReadException
	 *             If some exception occurs when reading the memory.
	 */
	public int readInt(int pos) throws MemoryNotMappedException,
			MemoryReadException {
		if (mapBuf == null)
			throw new MemoryNotMappedException(
					"the file not mapped into memory.");
		if (pos < 0)
			throw new MemoryReadException("the memory map is underflow.");
		if (pos > this.capacity - 4)
			throw new MemoryReadException("the memory map is overflow.");
		readLock.lock();
		try {
			mapBuf.position(pos);
			return mapBuf.getInt();
		} finally {
			readLock.unlock();
		}
	}

	/**
	 * 在內存映象的指定位置讀取一個長整數
	 * 
	 * @param pos
	 *            The dest position of the memory map.
	 * @return The long nubmer if successed.
	 * @throws MemoryNotMappedException
	 *             If the file not mapped into memory
	 * @throws MemoryReadException
	 *             If some exception occurs when reading the memory.
	 */
	public long readLong(int pos) throws MemoryNotMappedException,
			MemoryReadException {
		if (mapBuf == null)
			throw new MemoryNotMappedException(
					"the file not mapped into memory.");
		if (pos < 0)
			throw new MemoryReadException("the memory map is underflow.");
		if (pos > this.capacity - 8)
			throw new MemoryReadException("the memory map is overflow.");
		readLock.lock();
		try {
			mapBuf.position(pos);
			return mapBuf.getLong();
		} finally {
			readLock.unlock();
		}
	}

	/**
	 * 在內存映象的指定位置讀取指定長度的字節數據
	 * 
	 * @param pos
	 *            The dest position of the memory map.
	 * @param len
	 *            The length of data.
	 * @return The long nubmer if successed.
	 * @throws MemoryNotMappedException
	 *             If the file not mapped into memory
	 * @throws MemoryReadException
	 *             If some exception occurs when reading the memory.
	 */
	public byte[] readBytes(int pos, int len) throws MemoryNotMappedException,
			MemoryReadException {
		if (mapBuf == null)
			throw new MemoryNotMappedException(
					"the file not mapped into memory.");
		if (pos < 0)
			throw new MemoryReadException("the memory map is underflow.");
		if (pos > this.capacity - len)
			throw new MemoryReadException("the memory map is overflow.");
		readLock.lock();
		try {
			mapBuf.position(pos);
			byte[] dst = new byte[len];
			mapBuf.get(dst);
			return dst;
		} finally {
			readLock.unlock();
		}
	}

	/**
	 * 在內存映象的指定位置重置一個字節
	 * 
	 * @param pos
	 *            The dest position of the memory map.
	 * @param value
	 *            The byte value of new data.
	 * @return The old value at the given position.
	 * @throws MemoryNotMappedException
	 *             If the file not mapped into memory
	 * @throws MemoryReadException
	 *             If some exception occurs when reading the memory.
	 */
	public byte readAndWrite(int pos, byte value) {
		if (mapBuf == null)
			throw new MemoryNotMappedException(
					"the file not mapped into memory.");
		if (pos < 0)
			throw new MemoryReadException("the memory map is underflow.");
		if (pos > this.capacity - 1)
			throw new MemoryReadException("the memory map is overflow.");
		writeLock.lock();
		try {
			mapBuf.position(pos);
			byte ret = mapBuf.get();
			mapBuf.position(pos);
			mapBuf.putInt(value);
			// mapBuf.force();
			return ret;
		} finally {
			writeLock.unlock();
		}
	}

	/**
	 * 在內存映象的指定位置重置一個整數
	 * 
	 * @param pos
	 *            The dest position of the memory map.
	 * @param value
	 *            The integer value of new data.
	 * @return The old value at the given position.
	 * @throws MemoryNotMappedException
	 *             If the file not mapped into memory
	 * @throws MemoryReadException
	 *             If some exception occurs when reading the memory.
	 */
	public int readAndWrite(int pos, int value) {
		if (mapBuf == null)
			throw new MemoryNotMappedException(
					"the file not mapped into memory.");
		if (pos < 0)
			throw new MemoryReadException("the memory map is underflow.");
		if (pos > this.capacity - 4)
			throw new MemoryReadException("the memory map is overflow.");
		writeLock.lock();
		try {
			mapBuf.position(pos);
			int ret = mapBuf.getInt();
			mapBuf.position(pos);
			mapBuf.putInt(value);
			// mapBuf.force();
			return ret;
		} finally {
			writeLock.unlock();
		}
	}

	/**
	 * 在內存映象的指定位置重置一塊的值
	 * 
	 * @param pos
	 *            The dest position of the memory map.
	 * @param value
	 *            The bytes array value of new data.
	 * @return The old bytes array at the given position.
	 * @throws MemoryNotMappedException
	 *             If the file not mapped into memory
	 * @throws MemoryReadException
	 *             If some exception occurs when reading the memory.
	 */
	public byte[] readAndWrite(int pos, byte[] value) {
		if (mapBuf == null)
			throw new MemoryNotMappedException(
					"the file not mapped into memory.");
		if (pos < 0)
			throw new MemoryReadException("the memory map is underflow.");
		if (pos > this.capacity - value.length)
			throw new MemoryReadException("the memory map is overflow.");
		writeLock.lock();
		try {
			mapBuf.position(pos);
			byte[] ret = new byte[value.length];
			mapBuf.get(ret);
			mapBuf.position(pos);
			mapBuf.put(value);
			// mapBuf.force();
			return ret;
		} finally {
			writeLock.unlock();
		}
	}

	/**
	 * 在內存映象的指定位置整數相加
	 * 
	 * @param pos
	 *            The dest position of the memory map.
	 * @param delta
	 *            The integer value of added data.
	 * @return The old integer value at the given position.
	 * @throws MemoryNotMappedException
	 *             If the file not mapped into memory
	 * @throws MemoryReadException
	 *             If some exception occurs when reading the memory.
	 */
	public int readAndAdd(int pos, int delta) {
		if (mapBuf == null)
			throw new MemoryNotMappedException(
					"the file not mapped into memory.");
		if (pos < 0)
			throw new MemoryReadException("the memory map is underflow.");
		if (pos > this.capacity - 4)
			throw new MemoryReadException("the memory map is overflow.");
		writeLock.lock();
		try {
			mapBuf.position(pos);
			int ret = mapBuf.getInt();
			mapBuf.position(pos);
			mapBuf.putInt(ret + delta);
			// mapBuf.force();
			return ret;
		} finally {
			writeLock.unlock();
		}
	}

	/**
	 * 在內存映象的指定位置整數相加
	 * 
	 * @param pos
	 *            The dest position of the memory map.
	 * @param delta
	 *            The integer value of added data.
	 * @return The new integer value at the given position.
	 * @throws MemoryNotMappedException
	 *             If the file not mapped into memory
	 * @throws MemoryReadException
	 *             If some exception occurs when reading the memory.
	 */
	public int addAndRead(int pos, int delta) {
		if (mapBuf == null)
			throw new MemoryNotMappedException(
					"the file not mapped into memory.");
		if (pos < 0)
			throw new MemoryReadException("the memory map is underflow.");
		if (pos > this.capacity - 4)
			throw new MemoryReadException("the memory map is overflow.");
		writeLock.lock();
		try {
			mapBuf.position(pos);
			int ret = mapBuf.getInt();
			mapBuf.position(pos);
			ret += delta;
			mapBuf.putInt(ret);
			// mapBuf.force();
			return ret;
		} finally {
			writeLock.unlock();
		}
	}

	/**
	 * 在內存映象的指定位置整數加一
	 * 
	 * @param pos
	 *            The dest position of the memory map.
	 * @return The old integer value at the given position.
	 * @throws MemoryNotMappedException
	 *             If the file not mapped into memory
	 * @throws MemoryReadException
	 *             If some exception occurs when reading the memory.
	 */
	public int readAndIncrement(int pos) {
		if (mapBuf == null)
			throw new MemoryNotMappedException(
					"the file not mapped into memory.");
		if (pos < 0)
			throw new MemoryReadException("the memory map is underflow.");
		if (pos > this.capacity - 4)
			throw new MemoryReadException("the memory map is overflow.");
		writeLock.lock();
		try {
			mapBuf.position(pos);
			int ret = mapBuf.getInt();
			mapBuf.position(pos);
			mapBuf.putInt(ret + 1);
			// mapBuf.force();
			return ret;
		} finally {
			writeLock.unlock();
		}
	}

	/**
	 * 在內存映象的指定位置整數加一
	 * 
	 * @param pos
	 *            The dest position of the memory map.
	 * @return The new integer value at the given position.
	 * @throws MemoryNotMappedException
	 *             If the file not mapped into memory
	 * @throws MemoryReadException
	 *             If some exception occurs when reading the memory.
	 */
	public int incrementAndRead(int pos) {
		if (mapBuf == null)
			throw new MemoryNotMappedException(
					"the file not mapped into memory.");
		if (pos < 0)
			throw new MemoryReadException("the memory map is underflow.");
		if (pos > this.capacity - 4)
			throw new MemoryReadException("the memory map is overflow.");
		writeLock.lock();
		try {
			mapBuf.position(pos);
			int ret = mapBuf.getInt();
			mapBuf.position(pos);
			mapBuf.putInt(++ret);
			// mapBuf.force();
			return ret;
		} finally {
			writeLock.unlock();
		}
	}

	/**
	 * 在內存映象的指定位置整數減一
	 * 
	 * @param pos
	 *            The dest position of the memory map.
	 * @return The old integer value at the given position.
	 * @throws MemoryNotMappedException
	 *             If the file not mapped into memory
	 * @throws MemoryReadException
	 *             If some exception occurs when reading the memory.
	 */
	public int readAndDecrement(int pos) {
		if (mapBuf == null)
			throw new MemoryNotMappedException(
					"the file not mapped into memory.");
		if (pos < 0)
			throw new MemoryReadException("the memory map is underflow.");
		if (pos > this.capacity - 4)
			throw new MemoryReadException("the memory map is overflow.");
		writeLock.lock();
		try {
			mapBuf.position(pos);
			int ret = mapBuf.getInt();
			mapBuf.position(pos);
			mapBuf.putInt(ret - 1);
			// mapBuf.force();
			return ret;
		} finally {
			writeLock.unlock();
		}
	}

	/**
	 * 在內存映象的指定位置整數減一
	 * 
	 * @param pos
	 *            The dest position of the memory map.
	 * @return The new integer value at the given position.
	 * @throws MemoryNotMappedException
	 *             If the file not mapped into memory
	 * @throws MemoryReadException
	 *             If some exception occurs when reading the memory.
	 */
	public int decrementAndRead(int pos) {
		if (mapBuf == null)
			throw new MemoryNotMappedException(
					"the file not mapped into memory.");
		if (pos < 0)
			throw new MemoryReadException("the memory map is underflow.");
		if (pos > this.capacity - 4)
			throw new MemoryReadException("the memory map is overflow.");
		writeLock.lock();
		try {
			mapBuf.position(pos);
			int ret = mapBuf.getInt();
			mapBuf.position(pos);
			mapBuf.putInt(--ret);
			// mapBuf.force();
			return ret;
		} finally {
			writeLock.unlock();
		}
	}

	public boolean isLoaded() {
		if (mapBuf == null) {
			return false;
		}
		return mapBuf.isLoaded();
	}

	public MappedByteBuffer force() {
		return this.force();
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人一区二区三区视频在线观看| 色综合一区二区三区| 亚洲免费观看高清在线观看| 日韩三级免费观看| 91久久精品一区二区三| 国产在线精品一区二区不卡了 | 国产高清不卡一区二区| 亚洲成人自拍网| 国产精品久久久久久久久免费相片| 制服视频三区第一页精品| 99久精品国产| 国产 日韩 欧美大片| 久久国产精品色| 亚洲国产精品嫩草影院| 中文字幕一区二区三区色视频| 精品国产一二三| 欧美群妇大交群中文字幕| 91亚洲国产成人精品一区二区三| 国产精品一线二线三线精华| 日韩电影免费在线观看网站| 亚洲一区二区欧美激情| 日韩理论片一区二区| 久久久美女毛片| 精品国产制服丝袜高跟| 欧美丰满少妇xxxxx高潮对白| 日本丰满少妇一区二区三区| 成人黄动漫网站免费app| 美女视频黄 久久| 日本成人超碰在线观看| 日韩电影免费在线| 免费成人在线观看视频| 天天影视网天天综合色在线播放| 亚洲精品亚洲人成人网在线播放| 中文字幕欧美激情一区| 国产亚洲制服色| 欧美国产日韩一二三区| 国产欧美精品区一区二区三区| 欧美不卡一二三| 精品久久久久久无| 日韩欧美高清一区| 欧美大片在线观看一区二区| 日韩一区二区电影在线| 日韩欧美亚洲国产精品字幕久久久 | 亚瑟在线精品视频| 丝袜美腿亚洲综合| 视频在线在亚洲| 日本人妖一区二区| 麻豆精品久久精品色综合| 另类小说欧美激情| 国产精品一区二区无线| 国产jizzjizz一区二区| 成人综合日日夜夜| 91在线视频网址| 日本二三区不卡| 9191国产精品| 精品国产第一区二区三区观看体验| 日韩女同互慰一区二区| 欧美精品一区二区三| 国产亚洲成av人在线观看导航| 久久精品视频一区二区三区| 国产精品你懂的在线欣赏| 中文字幕在线视频一区| 亚洲精品日韩一| 日韩国产在线观看| 国产精品一二三四| 91老师片黄在线观看| 欧美日韩一区二区在线观看| 欧美zozo另类异族| 国产精品传媒入口麻豆| 亚洲成人动漫在线观看| 韩国精品免费视频| 91免费看片在线观看| 欧美精选午夜久久久乱码6080| 欧美成人三级电影在线| 国产精品国产三级国产普通话三级| 亚洲男帅同性gay1069| 五月婷婷激情综合网| 国产精品亚洲а∨天堂免在线| 色中色一区二区| 欧美一级欧美一级在线播放| 国产亚洲午夜高清国产拍精品| 亚洲乱码中文字幕| 男女性色大片免费观看一区二区| 高清视频一区二区| 538在线一区二区精品国产| 国产视频一区在线观看| 夜夜精品浪潮av一区二区三区| 免费成人av资源网| 99精品欧美一区| 日韩欧美国产三级电影视频| 亚洲欧美综合网| 蜜桃久久久久久| av福利精品导航| 精品免费国产二区三区| 亚洲国产成人tv| 成人污视频在线观看| 8x8x8国产精品| 成人欧美一区二区三区| 奇米精品一区二区三区四区| 成人av在线播放网址| 9191久久久久久久久久久| 中文字幕亚洲一区二区av在线 | 青青草国产精品97视觉盛宴 | 色女孩综合影院| 久久综合一区二区| 亚洲福利一区二区三区| 99久久er热在这里只有精品15| 精品欧美一区二区三区精品久久| 亚洲一区二区三区在线播放| 国产99久久久国产精品免费看| 这里只有精品电影| 亚洲精品日日夜夜| 成人h动漫精品一区二| 精品国产一区二区在线观看| 亚洲va欧美va人人爽午夜| 色诱亚洲精品久久久久久| 国产日产欧美一区二区视频| 久久精品99国产国产精| 欧美色图免费看| 伊人婷婷欧美激情| 99久久99精品久久久久久| 欧美国产欧美综合| 国产麻豆精品久久一二三| 日韩免费观看高清完整版在线观看 | 国产欧美一区二区精品秋霞影院| 美女被吸乳得到大胸91| 欧美日本精品一区二区三区| 一区二区三区欧美亚洲| 91麻豆精品在线观看| 国产精品久久久久三级| 成人毛片老司机大片| 国产欧美1区2区3区| 国产激情偷乱视频一区二区三区| 欧美大片拔萝卜| 精品一区二区久久久| 精品久久久久久久人人人人传媒| 蜜桃av噜噜一区二区三区小说| 欧美精品成人一区二区三区四区| 亚洲成人精品在线观看| 欧美日韩一区二区三区四区五区| 亚洲图片有声小说| 欧美精品亚洲一区二区在线播放| 午夜欧美视频在线观看| 欧美伦理电影网| 麻豆精品视频在线观看| 欧美成人欧美edvon| 国产高清在线精品| 欧美国产一区二区| 一本高清dvd不卡在线观看| 一区二区三区中文字幕电影 | 91精品国产91久久久久久一区二区| 亚洲电影欧美电影有声小说| 91麻豆精品91久久久久久清纯| 香蕉久久夜色精品国产使用方法| 欧美另类久久久品| 免费成人在线观看视频| 精品日韩在线一区| 高清国产一区二区三区| 国产精品久久久久久久午夜片| 一本色道久久综合亚洲aⅴ蜜桃| 一区二区免费在线播放| 91精品久久久久久久91蜜桃 | 青青草国产成人av片免费 | 亚洲不卡一区二区三区| 日韩欧美国产综合| 成人精品一区二区三区四区 | 国产欧美日韩视频在线观看| 91在线精品一区二区| 亚洲国产美女搞黄色| 91精品国产麻豆国产自产在线 | 亚洲一区二区不卡免费| 欧美一级夜夜爽| 国产精品12区| 一区二区三区在线免费| 欧美日高清视频| 国产九色sp调教91| 亚洲视频一二三区| 88在线观看91蜜桃国自产| 国产一区二区精品在线观看| 亚洲欧美怡红院| 欧美一区二区啪啪| 成人中文字幕电影| 午夜精品一区二区三区三上悠亚 | 久久精品综合网| 91福利视频久久久久| 玖玖九九国产精品| 中文字幕在线一区| 日韩精品一区在线| 色94色欧美sute亚洲线路二 | 在线精品视频免费播放| 久久99久久久欧美国产| 亚洲激情第一区| 26uuu色噜噜精品一区| 色婷婷综合久久久中文一区二区| 青青草国产精品97视觉盛宴| 中文字幕一区av| 久久久综合视频| 在线成人av网站| 色婷婷av一区二区三区之一色屋| 久久99国产精品免费网站|