本文整理汇总了Java中org.apache.poi.util.LittleEndian类的典型用法代码示例。如果您正苦于以下问题:Java LittleEndian类的具体用法?Java LittleEndian怎么用?Java LittleEndian使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LittleEndian类属于org.apache.poi.util包,在下文中一共展示了LittleEndian类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testGetLong
import org.apache.poi.util.LittleEndian; //导入依赖的package包/类
@Test
public void testGetLong() throws IOException {
byte[] array = new byte[] { (byte)0x91, (byte)0xE9, 0x1D, (byte)0x98, 0x39, 0x01, 0x00, 0x00 };
HexDump.dump(array, 0, System.out, 0);
int offset = 0;
// System.out.println(((long) (array[offset + 7] & 0xff) << 56));
// System.out.println(((long) (array[offset + 6] & 0xff) << 48));
// System.out.println(((long) (array[offset + 5] & 0xff) << 40));
// System.out.println(((long) (array[offset + 4] & 0xff) << 32));
// System.out.println(((long) (array[offset + 3] & 0xff) << 24));
// System.out.println(((long) (array[offset + 2] & 0xff) << 16));
// System.out.println(((long) (array[offset + 1] & 0xff) << 8));
// System.out.println(((long) (array[offset + 0] & 0xff) << 0));
// System.out.println(((long) (array[offset + 5] & 0xff) << 40) |
// ((long) (array[offset + 4] & 0xff) << 32));
// System.out.println(BlockHeader.getLong(array, offset));
assertEquals(1346876860817L, LittleEndian.getLong(array, offset));
}
开发者ID:centic9,项目名称:CommonCrawlDocumentDownload,代码行数:23,代码来源:DocumentLocationTest.java
示例2: initDocProperties
import org.apache.poi.util.LittleEndian; //导入依赖的package包/类
/**
* inits this document DOP structure.
*
* @param tableStream The documents table stream.
*/
private void initDocProperties(byte[] tableStream)
{
int pos = LittleEndian.getInt(_header, 0x192);
int size = LittleEndian.getInt(_header, 0x196);
byte[] dop = new byte[size];
System.arraycopy(tableStream, pos, dop, 0, size);
_docProps._fFacingPages = (dop[0] & 0x1) > 0;
_docProps._fpc = (dop[0] & 0x60) >> 5;
short num = LittleEndian.getShort(dop, 2);
_docProps._rncFtn = (num & 0x3);
_docProps._nFtn = (short)(num & 0xfffc) >> 2;
num = LittleEndian.getShort(dop, 52);
_docProps._rncEdn = num & 0x3;
_docProps._nEdn = (short)(num & 0xfffc) >> 2;
num = LittleEndian.getShort(dop, 54);
_docProps._epc = num & 0x3;
}
开发者ID:rmage,项目名称:gnvc-ims,代码行数:26,代码来源:WordDocument.java
示例3: getGrpprl
import org.apache.poi.util.LittleEndian; //导入依赖的package包/类
/**
* Gets the papx for the pagraph at index in this fkp.
*
* @param index The index of the papx to get.
* @return a papx grpprl.
*/
public byte[] getGrpprl(int index)
{
int papxOffset = 2 * LittleEndian.getUnsignedByte(_fkp, ((_crun + 1) * 4) + (index * 13));
int size = 2 * LittleEndian.getUnsignedByte(_fkp, papxOffset);
if(size == 0)
{
size = 2 * LittleEndian.getUnsignedByte(_fkp, ++papxOffset);
}
else
{
size--;
}
byte[] papx = new byte[size];
System.arraycopy(_fkp, ++papxOffset, papx, 0, size);
return papx;
}
开发者ID:rmage,项目名称:gnvc-ims,代码行数:24,代码来源:PAPFormattedDiskPage.java
示例4: writeOut
import org.apache.poi.util.LittleEndian; //导入依赖的package包/类
/**
* Write the contents of the record back, so it can be written
* to disk
*/
public void writeOut(OutputStream out) throws IOException {
// First thing to do is update the raw bytes of the contents, based
// on the properties
updateRawContents();
// Now ensure that the header size is correct
int newSize = rawContents.length + reserved.length;
LittleEndian.putInt(_header,4,newSize);
// Write out the (new) header
out.write(_header);
// Write out the styles
out.write(rawContents);
// Write out any extra bits
out.write(reserved);
}
开发者ID:rmage,项目名称:gnvc-ims,代码行数:23,代码来源:StyleTextPropAtom.java
示例5: Type4
import org.apache.poi.util.LittleEndian; //导入依赖的package包/类
private Type4(String thingType, String bitType, byte[] data) {
super(thingType, bitType, data);
// Grab our 4x pre-data
preData = new int[4];
preData[0] = LittleEndian.getUShort(data, 8+0);
preData[1] = LittleEndian.getUShort(data, 8+2);
preData[2] = LittleEndian.getUShort(data, 8+4);
preData[3] = LittleEndian.getUShort(data, 8+6);
// And grab the 4 byte values
for(int i=0; i<numberOfPLCs; i++) {
plcValA[i] = LittleEndian.getUInt(data, 16+(8*i));
plcValB[i] = LittleEndian.getUInt(data, 16+(8*i)+4);
}
}
开发者ID:rmage,项目名称:gnvc-ims,代码行数:17,代码来源:QCPLCBit.java
示例6: Type8
import org.apache.poi.util.LittleEndian; //导入依赖的package包/类
private Type8(String thingType, String bitType, byte[] data) {
super(thingType, bitType, data);
// Grab our 7x pre-data
preData = new int[7];
preData[0] = LittleEndian.getUShort(data, 8+0);
preData[1] = LittleEndian.getUShort(data, 8+2);
preData[2] = LittleEndian.getUShort(data, 8+4);
preData[3] = LittleEndian.getUShort(data, 8+6);
preData[4] = LittleEndian.getUShort(data, 8+8);
preData[5] = LittleEndian.getUShort(data, 8+10);
preData[6] = LittleEndian.getUShort(data, 8+12);
// And grab the 4 byte values
for(int i=0; i<numberOfPLCs; i++) {
plcValA[i] = LittleEndian.getUInt(data, 22+(8*i));
plcValB[i] = LittleEndian.getUInt(data, 22+(8*i)+4);
}
}
开发者ID:rmage,项目名称:gnvc-ims,代码行数:20,代码来源:QCPLCBit.java
示例7: PieceDescriptor
import org.apache.poi.util.LittleEndian; //导入依赖的package包/类
public PieceDescriptor(byte[] buf, int offset)
{
descriptor = LittleEndian.getShort(buf, offset);
offset += LittleEndian.SHORT_SIZE;
fc = LittleEndian.getInt(buf, offset);
offset += LittleEndian.INT_SIZE;
prm = new PropertyModifier( LittleEndian.getShort(buf, offset));
// see if this piece uses unicode.
if ((fc & 0x40000000) == 0)
{
unicode = true;
}
else
{
unicode = false;
fc &= ~(0x40000000);//gives me FC in doc stream
fc /= 2;
}
}
开发者ID:rmage,项目名称:gnvc-ims,代码行数:22,代码来源:PieceDescriptor.java
示例8: 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);
}
开发者ID:rmage,项目名称:gnvc-ims,代码行数:31,代码来源:CompressedRTF.java
示例9: serialize
import org.apache.poi.util.LittleEndian; //导入依赖的package包/类
public void serialize( byte[] data, int offset )
{
LittleEndian.putUShort( data, 0x0 + offset, field_1_wIdent );
LittleEndian.putUShort( data, 0x2 + offset, field_2_nFib );
LittleEndian.putUShort( data, 0x4 + offset, field_3_unused );
LittleEndian.putUShort( data, 0x6 + offset, field_4_lid );
LittleEndian.putUShort( data, 0x8 + offset, field_5_pnNext );
LittleEndian.putShort( data, 0xa + offset, field_6_flags1 );
LittleEndian.putUShort( data, 0xc + offset, field_7_nFibBack );
LittleEndian.putInt( data, 0xe + offset, field_8_lKey );
data[ 0x12 + offset ] = field_9_envr;
data[ 0x13 + offset ] = field_10_flags2;
LittleEndian.putShort( data, 0x14 + offset, field_11_Chs );
LittleEndian.putShort( data, 0x16 + offset, field_12_chsTables );
LittleEndian.putInt( data, 0x18 + offset, field_13_fcMin );
LittleEndian.putInt( data, 0x1c + offset, field_14_fcMac );
}
开发者ID:rmage,项目名称:gnvc-ims,代码行数:18,代码来源:FibBaseAbstractType.java
示例10: TNEFDateAttribute
import org.apache.poi.util.LittleEndian; //导入依赖的package包/类
/**
* Constructs a single new date attribute from the id, type,
* and the contents of the stream
*/
protected TNEFDateAttribute(int id, int type, InputStream inp) throws IOException {
super(id, type, inp);
byte[] data = getData();
if(data.length == 8) {
// The value is a 64 bit Windows Filetime
this.data = Util.filetimeToDate(
LittleEndian.getLong(getData(), 0)
);
} else if(data.length == 14) {
// It's the 7 date fields. We think it's in UTC...
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
c.set(Calendar.YEAR, LittleEndian.getUShort(data, 0));
c.set(Calendar.MONTH, LittleEndian.getUShort(data, 2) - 1); // Java months are 0 based!
c.set(Calendar.DAY_OF_MONTH, LittleEndian.getUShort(data, 4));
c.set(Calendar.HOUR_OF_DAY, LittleEndian.getUShort(data, 6));
c.set(Calendar.MINUTE, LittleEndian.getUShort(data, 8));
c.set(Calendar.SECOND, LittleEndian.getUShort(data, 10));
// The 7th field is day of week, which we don't require
c.set(Calendar.MILLISECOND, 0); // Not set in the file
this.data = c.getTime();
} else {
throw new IllegalArgumentException("Invalid date, found " + data.length + " bytes");
}
}
开发者ID:rmage,项目名称:gnvc-ims,代码行数:30,代码来源:TNEFDateAttribute.java
示例11: ComplexFileTable
import org.apache.poi.util.LittleEndian; //导入依赖的package包/类
public ComplexFileTable(byte[] documentStream, byte[] tableStream, int offset, int fcMin) throws IOException
{
//skips through the prms before we reach the piece table. These contain data
//for actual fast saved files
List<SprmBuffer> sprmBuffers = new LinkedList<SprmBuffer>();
while ( tableStream[offset] == GRPPRL_TYPE )
{
offset++;
int size = LittleEndian.getShort( tableStream, offset );
offset += LittleEndian.SHORT_SIZE;
byte[] bs = LittleEndian.getByteArray( tableStream, offset, size );
offset += size;
SprmBuffer sprmBuffer = new SprmBuffer( bs, false, 0 );
sprmBuffers.add( sprmBuffer );
}
this._grpprls = sprmBuffers.toArray( new SprmBuffer[sprmBuffers.size()] );
if(tableStream[offset] != TEXT_PIECE_TABLE_TYPE)
{
throw new IOException("The text piece table is corrupted");
}
int pieceTableSize = LittleEndian.getInt(tableStream, ++offset);
offset += LittleEndian.INT_SIZE;
_tpt = new TextPieceTable(documentStream, tableStream, offset, pieceTableSize, fcMin);
}
开发者ID:rmage,项目名称:gnvc-ims,代码行数:27,代码来源:ComplexFileTable.java
示例12: fillFields
import org.apache.poi.util.LittleEndian; //导入依赖的package包/类
protected void fillFields( byte[] data, int offset )
{
field_1_cbMac = LittleEndian.getInt( data, 0x0 + offset );
field_2_reserved1 = LittleEndian.getInt( data, 0x4 + offset );
field_3_reserved2 = LittleEndian.getInt( data, 0x8 + offset );
field_4_reserved3 = LittleEndian.getInt( data, 0xc + offset );
field_5_reserved4 = LittleEndian.getInt( data, 0x10 + offset );
field_6_ccpText = LittleEndian.getInt( data, 0x14 + offset );
field_7_ccpFtn = LittleEndian.getInt( data, 0x18 + offset );
field_8_ccpHdd = LittleEndian.getInt( data, 0x1c + offset );
field_9_ccpMcr = LittleEndian.getInt( data, 0x20 + offset );
field_10_ccpAtn = LittleEndian.getInt( data, 0x24 + offset );
field_11_ccpEdn = LittleEndian.getInt( data, 0x28 + offset );
field_12_ccpTxbx = LittleEndian.getInt( data, 0x2c + offset );
field_13_ccpHdrTxbx = LittleEndian.getInt( data, 0x30 + offset );
field_14_reserved5 = LittleEndian.getInt( data, 0x34 + offset );
}
开发者ID:rmage,项目名称:gnvc-ims,代码行数:18,代码来源:FibRgLw95AbstractType.java
示例13: readValue
import org.apache.poi.util.LittleEndian; //导入依赖的package包/类
@Override
public void readValue(InputStream stream) throws IOException {
// 8 bytes of reserved zeros
LittleEndian.readLong(stream);
// Nexts and counts
nextRecipientId = LittleEndian.readUInt(stream);
nextAttachmentId = LittleEndian.readUInt(stream);
recipientCount = LittleEndian.readUInt(stream);
attachmentCount = LittleEndian.readUInt(stream);
// 8 bytes of reserved zeros
LittleEndian.readLong(stream);
// Now properties
readProperties(stream);
}
开发者ID:rmage,项目名称:gnvc-ims,代码行数:18,代码来源:MessagePropertiesChunk.java
示例14: getGrpprl
import org.apache.poi.util.LittleEndian; //导入依赖的package包/类
/**
* Gets the papx grpprl for the paragraph at index in this fkp.
*
* @param index The index of the papx to get.
* @return a papx grpprl.
*/
protected byte[] getGrpprl(int index)
{
int papxOffset = 2 * LittleEndian.getUnsignedByte(_fkp, _offset + (((_crun + 1) * FC_SIZE) + (index * BX_SIZE)));
int size = 2 * LittleEndian.getUnsignedByte(_fkp, _offset + papxOffset);
if(size == 0)
{
size = 2 * LittleEndian.getUnsignedByte(_fkp, _offset + ++papxOffset);
}
else
{
size--;
}
byte[] papx = new byte[size];
System.arraycopy(_fkp, _offset + ++papxOffset, papx, 0, size);
return papx;
}
开发者ID:rmage,项目名称:gnvc-ims,代码行数:24,代码来源:PAPFormattedDiskPage.java
示例15: toByteArray
import org.apache.poi.util.LittleEndian; //导入依赖的package包/类
protected byte[] toByteArray()
{
// set up the fc
int tempFc = fc;
if (!unicode)
{
tempFc *= 2;
tempFc |= (0x40000000);
}
int offset = 0;
byte[] buf = new byte[8];
LittleEndian.putShort(buf, offset, descriptor);
offset += LittleEndian.SHORT_SIZE;
LittleEndian.putInt(buf, offset, tempFc);
offset += LittleEndian.INT_SIZE;
LittleEndian.putShort(buf, offset, prm.getValue());
return buf;
}
开发者ID:rmage,项目名称:gnvc-ims,代码行数:22,代码来源:PieceDescriptor.java
示例16: serialize
import org.apache.poi.util.LittleEndian; //导入依赖的package包/类
public void serialize( byte[] data, int offset )
{
LittleEndian.putInt( data, 0x0 + offset, field_1_cbMac );
LittleEndian.putInt( data, 0x4 + offset, field_2_reserved1 );
LittleEndian.putInt( data, 0x8 + offset, field_3_reserved2 );
LittleEndian.putInt( data, 0xc + offset, field_4_ccpText );
LittleEndian.putInt( data, 0x10 + offset, field_5_ccpFtn );
LittleEndian.putInt( data, 0x14 + offset, field_6_ccpHdd );
LittleEndian.putInt( data, 0x18 + offset, field_7_reserved3 );
LittleEndian.putInt( data, 0x1c + offset, field_8_ccpAtn );
LittleEndian.putInt( data, 0x20 + offset, field_9_ccpEdn );
LittleEndian.putInt( data, 0x24 + offset, field_10_ccpTxbx );
LittleEndian.putInt( data, 0x28 + offset, field_11_ccpHdrTxbx );
LittleEndian.putInt( data, 0x2c + offset, field_12_reserved4 );
LittleEndian.putInt( data, 0x30 + offset, field_13_reserved5 );
LittleEndian.putInt( data, 0x34 + offset, field_14_reserved6 );
LittleEndian.putInt( data, 0x38 + offset, field_15_reserved7 );
LittleEndian.putInt( data, 0x3c + offset, field_16_reserved8 );
LittleEndian.putInt( data, 0x40 + offset, field_17_reserved9 );
LittleEndian.putInt( data, 0x44 + offset, field_18_reserved10 );
LittleEndian.putInt( data, 0x48 + offset, field_19_reserved11 );
LittleEndian.putInt( data, 0x4c + offset, field_20_reserved12 );
LittleEndian.putInt( data, 0x50 + offset, field_21_reserved13 );
LittleEndian.putInt( data, 0x54 + offset, field_22_reserved14 );
}
开发者ID:rmage,项目名称:gnvc-ims,代码行数:26,代码来源:FibRgLw97AbstractType.java
示例17: serialize
import org.apache.poi.util.LittleEndian; //导入依赖的package包/类
public void serialize( byte[] data, int offset )
{
LittleEndian.putShort( data, 0x0 + offset, field_1_reserved1 );
LittleEndian.putShort( data, 0x2 + offset, field_2_reserved2 );
LittleEndian.putShort( data, 0x4 + offset, field_3_reserved3 );
LittleEndian.putShort( data, 0x6 + offset, field_4_reserved4 );
LittleEndian.putShort( data, 0x8 + offset, field_5_reserved5 );
LittleEndian.putShort( data, 0xa + offset, field_6_reserved6 );
LittleEndian.putShort( data, 0xc + offset, field_7_reserved7 );
LittleEndian.putShort( data, 0xe + offset, field_8_reserved8 );
LittleEndian.putShort( data, 0x10 + offset, field_9_reserved9 );
LittleEndian.putShort( data, 0x12 + offset, field_10_reserved10 );
LittleEndian.putShort( data, 0x14 + offset, field_11_reserved11 );
LittleEndian.putShort( data, 0x16 + offset, field_12_reserved12 );
LittleEndian.putShort( data, 0x18 + offset, field_13_reserved13 );
LittleEndian.putShort( data, 0x1a + offset, field_14_lidFE );
}
开发者ID:rmage,项目名称:gnvc-ims,代码行数:18,代码来源:FibRgW97AbstractType.java
示例18: Slide
import org.apache.poi.util.LittleEndian; //导入依赖的package包/类
/**
* Create a new, empty, Slide, along with its required
* child records.
*/
public Slide(){
_header = new byte[8];
LittleEndian.putUShort(_header, 0, 15);
LittleEndian.putUShort(_header, 2, (int)_type);
LittleEndian.putInt(_header, 4, 0);
slideAtom = new SlideAtom();
ppDrawing = new PPDrawing();
ColorSchemeAtom colorAtom = new ColorSchemeAtom();
_children = new Record[] {
slideAtom,
ppDrawing,
colorAtom
};
}
开发者ID:rmage,项目名称:gnvc-ims,代码行数:22,代码来源:Slide.java
示例19: extractText
import org.apache.poi.util.LittleEndian; //导入依赖的package包/类
public boolean extractText( OutputStreamWriter out, byte[] paramArrayOfByte ) throws Exception
{
int i = LittleEndian.getInt(paramArrayOfByte, 24);
int j = LittleEndian.getInt(paramArrayOfByte, 28);
int k = LittleEndian.getInt(paramArrayOfByte, 184);
int m = LittleEndian.getInt(paramArrayOfByte, 188);
Word6CHPBinTable localWord6CHPBinTable = new Word6CHPBinTable( paramArrayOfByte, k, m, i );
List localList = localWord6CHPBinTable.getTextRuns();
Iterator localIterator = localList.iterator();
while( localIterator.hasNext() )
{
CHPX localCHPX = (CHPX)localIterator.next();
int n = localCHPX.getStart() + i;
int i1 = localCHPX.getEnd() + i;
if( !isDeleted(localCHPX.getGrpprl()) )
{
String str = new String(paramArrayOfByte, n, Math.min(i1, j) - n, "Cp1252");
str = str.replaceAll("\r\n", "\n");
str = str.replaceAll("\r", "\n");
out.write(str);
if( i1 >= j )
{
break;
}
}
}
return true;
}
开发者ID:weizhiping,项目名称:ebook,代码行数:35,代码来源:Word6ExtractorEx.java
示例20: readFromOldIndexBlock
import org.apache.poi.util.LittleEndian; //导入依赖的package包/类
public static DocumentLocation readFromOldIndexBlock(byte[] block, int index) {
// System.out.println(HexDump.dump(Arrays.copyOfRange(block, index-8, index), 0, 0));
// System.out.println(HexDump.dump(Arrays.copyOfRange(block, index, index+8), 0, 0));
// System.out.println(HexDump.dump(Arrays.copyOfRange(block, index+8, index+16), 0, 0));
// System.out.println(HexDump.dump(Arrays.copyOfRange(block, index+16, index+20), 0, 0));
// System.out.println(HexDump.dump(Arrays.copyOfRange(block, index+20, index+28), 0, 0));
// System.out.println(HexDump.dump(Arrays.copyOfRange(block, index+28, index+32), 0, 0));
DocumentLocation header = new DocumentLocation();
header.segmentId = LittleEndian.getLong(block, index);
int offset = 8;
header.arcCreationDate = LittleEndian.getLong(block, index+offset);
offset += 8;
header.arcFilePartition = LittleEndian.getUInt(block, index+offset);
offset += 4;
header.arcFileOffset = LittleEndian.getLong(block, index+offset);
offset += 8;
header.arcFileSize = LittleEndian.getUInt(block, index+offset);
//System.out.println(segmentId + "/" + arcCreationDate + "/" + arcFilePartition + "/" + arcFileOffset + "/" + arcFileSize);
return header;
}
开发者ID:centic9,项目名称:CommonCrawlDocumentDownload,代码行数:29,代码来源:DocumentLocation.java
注:本文中的org.apache.poi.util.LittleEndian类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论