本文整理汇总了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