當前位置: 首頁>>代碼示例>>Java>>正文


Java RandomAccessData.getSize方法代碼示例

本文整理匯總了Java中org.springframework.boot.loader.data.RandomAccessData.getSize方法的典型用法代碼示例。如果您正苦於以下問題:Java RandomAccessData.getSize方法的具體用法?Java RandomAccessData.getSize怎麽用?Java RandomAccessData.getSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.boot.loader.data.RandomAccessData的用法示例。


在下文中一共展示了RandomAccessData.getSize方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: CentralDirectoryEndRecord

import org.springframework.boot.loader.data.RandomAccessData; //導入方法依賴的package包/類
/**
 * Create a new {@link CentralDirectoryEndRecord} instance from the specified
 * {@link RandomAccessData}, searching backwards from the end until a valid block is
 * located.
 * @param data the source data
 * @throws IOException in case of I/O errors
 */
CentralDirectoryEndRecord(RandomAccessData data) throws IOException {
	this.block = createBlockFromEndOfData(data, READ_BLOCK_SIZE);
	this.size = MINIMUM_SIZE;
	this.offset = this.block.length - this.size;
	while (!isValid()) {
		this.size++;
		if (this.size > this.block.length) {
			if (this.size >= MAXIMUM_SIZE || this.size > data.getSize()) {
				throw new IOException("Unable to find ZIP central directory "
						+ "records after reading " + this.size + " bytes");
			}
			this.block = createBlockFromEndOfData(data, this.size + READ_BLOCK_SIZE);
		}
		this.offset = this.block.length - this.size;
	}
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:24,代碼來源:CentralDirectoryEndRecord.java

示例2: getStartOfArchive

import org.springframework.boot.loader.data.RandomAccessData; //導入方法依賴的package包/類
/**
 * Returns the location in the data that the archive actually starts. For most files
 * the archive data will start at 0, however, it is possible to have prefixed bytes
 * (often used for startup scripts) at the beginning of the data.
 * @param data the source data
 * @return the offset within the data where the archive begins
 */
public long getStartOfArchive(RandomAccessData data) {
	long length = Bytes.littleEndianValue(this.block, this.offset + 12, 4);
	long specifiedOffset = Bytes.littleEndianValue(this.block, this.offset + 16, 4);
	long actualOffset = data.getSize() - this.size - length;
	return actualOffset - specifiedOffset;
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:14,代碼來源:CentralDirectoryEndRecord.java


注:本文中的org.springframework.boot.loader.data.RandomAccessData.getSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。