本文整理汇总了Java中org.apache.poi.util.LittleEndian.readInt方法的典型用法代码示例。如果您正苦于以下问题:Java LittleEndian.readInt方法的具体用法?Java LittleEndian.readInt怎么用?Java LittleEndian.readInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.poi.util.LittleEndian
的用法示例。
在下文中一共展示了LittleEndian.readInt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: HMEFDumper
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
public HMEFDumper(InputStream inp) throws IOException {
this.inp = inp;
// Check the signature matches
long sig = LittleEndian.readInt(inp);
if(sig != HMEFMessage.HEADER_SIGNATURE) {
throw new IllegalArgumentException(
"TNEF signature not detected in file, " +
"expected " + HMEFMessage.HEADER_SIGNATURE +
" but got " + sig
);
}
// Skip over the File ID
LittleEndian.readUShort(inp);
}
示例2: decompress
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
/**
* Decompresses the whole of the compressed RTF
* stream, outputting the resulting RTF bytes.
* Note - will decompress any padding at the end of
* the input, if present, use {@link #getDeCompressedSize()}
* if you need to know how much of the result is
* real. (Padding may be up to 7 bytes).
*/
public void decompress(InputStream src, OutputStream res) throws IOException {
// Validate the header on the front of the RTF
compressedSize = LittleEndian.readInt(src);
decompressedSize = LittleEndian.readInt(src);
int compressionType = LittleEndian.readInt(src);
int dataCRC = LittleEndian.readInt(src);
// TODO - Handle CRC checking on the output side
// Do we need to do anything?
if(compressionType == UNCOMPRESSED_SIGNATURE_INT) {
// Nope, nothing fancy to do
IOUtils.copy(src, res);
} else if(compressionType == COMPRESSED_SIGNATURE_INT) {
// We need to decompress it below
} else {
throw new IllegalArgumentException("Invalid compression signature " + compressionType);
}
// Have it processed
super.decompress(src, res);
}
示例3: HMEFMessage
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
public HMEFMessage(InputStream inp) throws IOException {
// Check the signature matches
long sig = LittleEndian.readInt(inp);
if(sig != HEADER_SIGNATURE) {
throw new IllegalArgumentException(
"TNEF signature not detected in file, " +
"expected " + HEADER_SIGNATURE + " but got " + sig
);
}
// Read the File ID
fileId = LittleEndian.readUShort(inp);
// Now begin processing the contents
process(inp, 0);
}
示例4: getLength
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
private static int getLength(MAPIType type, InputStream inp) throws IOException {
if (type.isFixedLength()) {
return type.getLength();
}
if (type == Types.ASCII_STRING ||
type == Types.UNICODE_STRING ||
type == Types.DIRECTORY ||
type == Types.BINARY) {
// Need to read the length, as it varies
return LittleEndian.readInt(inp);
} else {
throw new IllegalArgumentException("Unknown type " + type);
}
}
示例5: TNEFAttribute
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
/**
* Constructs a single new attribute from the id, type,
* and the contents of the stream
*/
protected TNEFAttribute(int id, int type, InputStream inp) throws IOException {
this.type = type;
int length = LittleEndian.readInt(inp);
property = TNEFProperty.getBest(id, type);
data = new byte[length];
IOUtils.readFully(inp, data);
checksum = LittleEndian.readUShort(inp);
}