本文整理汇总了Java中org.apache.poi.util.LittleEndian.getShort方法的典型用法代码示例。如果您正苦于以下问题:Java LittleEndian.getShort方法的具体用法?Java LittleEndian.getShort怎么用?Java LittleEndian.getShort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.poi.util.LittleEndian
的用法示例。
在下文中一共展示了LittleEndian.getShort方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillFields
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
protected void fillFields( byte[] data, int offset )
{
field_1_wIdent = LittleEndian.getShort( data, 0x0 + offset );
field_2_nFib = LittleEndian.getShort( data, 0x2 + offset );
field_3_unused = LittleEndian.getShort( data, 0x4 + offset );
field_4_lid = LittleEndian.getShort( data, 0x6 + offset );
field_5_pnNext = LittleEndian.getShort( data, 0x8 + offset );
field_6_flags1 = LittleEndian.getShort( data, 0xa + offset );
field_7_nFibBack = LittleEndian.getShort( data, 0xc + offset );
field_8_lKey = LittleEndian.getInt( data, 0xe + offset );
field_9_envr = data[ 0x12 + offset ];
field_10_flags2 = data[ 0x13 + offset ];
field_11_Chs = LittleEndian.getShort( data, 0x14 + offset );
field_12_chsTables = LittleEndian.getShort( data, 0x16 + offset );
field_13_fcMin = LittleEndian.getInt( data, 0x18 + offset );
field_14_fcMac = LittleEndian.getInt( data, 0x1c + offset );
}
示例2: getIstd
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
public short getIstd()
{
if ( _buf == null )
return 0;
byte[] buf = getGrpprl();
if (buf.length == 0)
{
return 0;
}
if (buf.length == 1)
{
return (short)LittleEndian.getUnsignedByte(buf, 0);
}
return LittleEndian.getShort(buf);
}
示例3: read
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
public void read(byte[] data, int offset){
int pos = offset;
int key = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE; //header key
if (key != APMHEADER_KEY) throw new HSLFException("Not a valid WMF file");
handle = LittleEndian.getUShort(data, pos); pos += LittleEndian.SHORT_SIZE;
left = LittleEndian.getUShort(data, pos); pos += LittleEndian.SHORT_SIZE;
top = LittleEndian.getUShort(data, pos); pos += LittleEndian.SHORT_SIZE;
right = LittleEndian.getUShort(data, pos); pos += LittleEndian.SHORT_SIZE;
bottom = LittleEndian.getUShort(data, pos); pos += LittleEndian.SHORT_SIZE;
inch = LittleEndian.getUShort(data, pos); pos += LittleEndian.SHORT_SIZE;
reserved = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
checksum = LittleEndian.getShort(data, pos); pos += LittleEndian.SHORT_SIZE;
if (checksum != getChecksum()){
logger.log(POILogger.WARN, "WMF checksum does not match the header data");
}
}
示例4: 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;
}
}
示例5: OldSectionTable
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
public OldSectionTable( byte[] documentStream, int offset, int size )
{
PlexOfCps sedPlex = new PlexOfCps( documentStream, offset, size, 12 );
int length = sedPlex.length();
for (int x = 0; x < length; x++)
{
GenericPropertyNode node = sedPlex.getProperty(x);
SectionDescriptor sed = new SectionDescriptor(node.getBytes(), 0);
int fileOffset = sed.getFc();
int startAt = node.getStart();
int endAt = node.getEnd();
SEPX sepx;
// check for the optimization
if (fileOffset == 0xffffffff)
{
sepx = new SEPX(sed, startAt, endAt, new byte[0]);
}
else
{
// The first short at the offset is the size of the grpprl.
int sepxSize = LittleEndian.getShort(documentStream, fileOffset);
// Because we don't properly know about all the details of the old
// section properties, and we're trying to decode them as if they
// were the new ones, we sometimes "need" more data than we have.
// As a workaround, have a few extra 0 bytes on the end!
byte[] buf = new byte[sepxSize+2];
fileOffset += LittleEndian.SHORT_SIZE;
System.arraycopy(documentStream, fileOffset, buf, 0, buf.length);
sepx = new SEPX(sed, startAt, endAt, buf);
}
_sections.add( sepx );
}
Collections.sort( _sections, PropertyNode.StartComparator.instance );
}
示例6: paragraph
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
public void paragraph(PapxNode papx)
{
if (_beginHeaders)
{
_hdrParagraphs.add(papx);
}
byte[] bytePapx = papx.getPapx();
int istd = LittleEndian.getShort(bytePapx, 0);
_currentStd = _stsh.getStyleDescription(istd);
ParagraphProperties pap = (ParagraphProperties)StyleSheet.uncompressProperty(bytePapx, _currentStd.getPAP(), _stsh);
if (pap.getFTtp() > 0)
{
TableProperties tap = (TableProperties)StyleSheet.uncompressProperty(bytePapx, new TableProperties(), _stsh);
_listener.tableRowEnd(tap, papx.getStart() - _fcMin, papx.getEnd() - _fcMin);
}
else if (pap.getIlfo() > 0)
{
_holdParagraph = true;
_endHoldIndex = papx.getEnd();
_onHold.add(papx);
}
else
{
_listener.paragraph(pap, papx.getStart() - _fcMin, papx.getEnd() - _fcMin);
}
}
示例7: getTextSpecInfoRuns
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
public TextSpecInfoRun[] getTextSpecInfoRuns(){
ArrayList<TextSpecInfoRun> lst = new ArrayList<TextSpecInfoRun>();
int pos = 0;
int[] bits = {1, 0, 2};
while(pos < _data.length) {
TextSpecInfoRun run = new TextSpecInfoRun();
run.len = LittleEndian.getInt(_data, pos); pos += 4;
run.mask = LittleEndian.getInt(_data, pos); pos += 4;
for (int i = 0; i < bits.length; i++) {
if((run.mask & 1 << bits[i]) != 0){
switch (bits[i]){
case 0:
run.spellInfo = LittleEndian.getShort(_data, pos); pos += 2;
break;
case 1:
run.langId = LittleEndian.getShort(_data, pos); pos += 2;
break;
case 2:
run.altLangId = LittleEndian.getShort(_data, pos); pos += 2;
break;
}
}
}
lst.add(run);
}
return lst.toArray(new TextSpecInfoRun[lst.size()]);
}
示例8: SectionDescriptor
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
public SectionDescriptor(byte[] buf, int offset)
{
fn = LittleEndian.getShort(buf, offset);
offset += LittleEndian.SHORT_SIZE;
fcSepx = LittleEndian.getInt(buf, offset);
offset += LittleEndian.INT_SIZE;
fnMpr = LittleEndian.getShort(buf, offset);
offset += LittleEndian.SHORT_SIZE;
fcMpr = LittleEndian.getInt(buf, offset);
}
示例9: init
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
/**
* parse the record data and initialize styles
*/
protected void init(){
//type of the text
int type = getTextType();
int head;
int pos = 0;
//number of indentation levels
short levels = LittleEndian.getShort(_data, 0);
pos += LittleEndian.SHORT_SIZE;
prstyles = new TextPropCollection[levels];
chstyles = new TextPropCollection[levels];
for(short j = 0; j < levels; j++) {
if (type >= TextHeaderAtom.CENTRE_BODY_TYPE) {
// Fetch the 2 byte value, that is safe to ignore for some types of text
short val = LittleEndian.getShort(_data, pos);
pos += LittleEndian.SHORT_SIZE;
}
head = LittleEndian.getInt(_data, pos);
pos += LittleEndian.INT_SIZE;
TextPropCollection prprops = new TextPropCollection(0);
pos += prprops.buildTextPropList( head, getParagraphProps(type, j), _data, pos);
prstyles[j] = prprops;
head = LittleEndian.getInt(_data, pos);
pos += LittleEndian.INT_SIZE;
TextPropCollection chprops = new TextPropCollection(0);
pos += chprops.buildTextPropList( head, getCharacterProps(type, j), _data, pos);
chstyles[j] = chprops;
}
}
示例10: fillFields
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
protected void fillFields(byte[] data, int offset)
{
field_1_rgf = LittleEndian.getShort(data, 0x0 + offset);
field_2_wWidth = LittleEndian.getShort(data, 0x2 + offset);
setBrcTop(new BorderCode(data, 0x4 + offset));
setBrcLeft(new BorderCode(data, 0x8 + offset));
setBrcBottom(new BorderCode(data, 0xc + offset));
setBrcRight(new BorderCode(data, 0x10 + offset));
}
示例11: findText
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
/**
* Goes through the piece table and parses out the info regarding the text
* blocks. For Word 97 and greater all text is stored in the "complex" way
* because of unicode.
*
* @param tableStream buffer containing the main table stream.
* @param beginning of the complex data.
* @throws IOException
*/
private void findText(byte[] tableStream, int complexOffset) throws IOException
{
//actual text
int pos = complexOffset;
//skips through the prms before we reach the piece table. These contain data
//for actual fast saved files
while(tableStream[pos] == 1)
{
pos++;
int skip = LittleEndian.getShort(tableStream, pos);
pos += 2 + skip;
}
if(tableStream[pos] != 2)
{
throw new IOException("corrupted Word file");
}
//parse out the text pieces
int pieceTableSize = LittleEndian.getInt(tableStream, ++pos);
pos += 4;
int pieces = (pieceTableSize - 4) / 12;
for (int x = 0; x < pieces; x++)
{
int filePos = LittleEndian.getInt(tableStream, pos + ((pieces + 1) * 4) + (x * 8) + 2);
boolean unicode = false;
if ((filePos & 0x40000000) == 0)
{
unicode = true;
}
else
{
unicode = false;
filePos &= ~(0x40000000);//gives me FC in doc stream
filePos /= 2;
}
int totLength = LittleEndian.getInt(tableStream, pos + (x + 1) * 4) -
LittleEndian.getInt(tableStream, pos + (x * 4));
TextPiece piece = new TextPiece(filePos, totLength, unicode);
_text.add(piece);
}
}
示例12: fillFields
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
protected void fillFields( byte[] data, int offset )
{
field_1_value = LittleEndian.getShort( data, 0x0 + offset );
}
示例13: DropCapSpecifier
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
public DropCapSpecifier( byte[] buf, int offset )
{
this( LittleEndian.getShort( buf, offset ) );
}
示例14: fillFields
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
protected void fillFields(byte [] data, short size, int offset)
{
field_1_formatFlags = data[ 0x0 + offset ];
field_2_unused2 = data[ 0x1 + offset ];
field_3_footnoteInfo = LittleEndian.getShort(data, 0x2 + offset);
field_4_fOutlineDirtySave = data[ 0x4 + offset ];
field_5_docinfo = data[ 0x5 + offset ];
field_6_docinfo1 = data[ 0x6 + offset ];
field_7_docinfo2 = data[ 0x7 + offset ];
field_8_docinfo3 = LittleEndian.getShort(data, 0x8 + offset);
field_9_dxaTab = LittleEndian.getShort(data, 0xa + offset);
field_10_wSpare = LittleEndian.getShort(data, 0xc + offset);
field_11_dxaHotz = LittleEndian.getShort(data, 0xe + offset);
field_12_cConsexHypLim = LittleEndian.getShort(data, 0x10 + offset);
field_13_wSpare2 = LittleEndian.getShort(data, 0x12 + offset);
field_14_dttmCreated = LittleEndian.getInt(data, 0x14 + offset);
field_15_dttmRevised = LittleEndian.getInt(data, 0x18 + offset);
field_16_dttmLastPrint = LittleEndian.getInt(data, 0x1c + offset);
field_17_nRevision = LittleEndian.getShort(data, 0x20 + offset);
field_18_tmEdited = LittleEndian.getInt(data, 0x22 + offset);
field_19_cWords = LittleEndian.getInt(data, 0x26 + offset);
field_20_cCh = LittleEndian.getInt(data, 0x2a + offset);
field_21_cPg = LittleEndian.getShort(data, 0x2e + offset);
field_22_cParas = LittleEndian.getInt(data, 0x30 + offset);
field_23_Edn = LittleEndian.getShort(data, 0x34 + offset);
field_24_Edn1 = LittleEndian.getShort(data, 0x36 + offset);
field_25_cLines = LittleEndian.getInt(data, 0x38 + offset);
field_26_cWordsFtnEnd = LittleEndian.getInt(data, 0x3c + offset);
field_27_cChFtnEdn = LittleEndian.getInt(data, 0x40 + offset);
field_28_cPgFtnEdn = LittleEndian.getShort(data, 0x44 + offset);
field_29_cParasFtnEdn = LittleEndian.getInt(data, 0x46 + offset);
field_30_cLinesFtnEdn = LittleEndian.getInt(data, 0x4a + offset);
field_31_lKeyProtDoc = LittleEndian.getInt(data, 0x4e + offset);
field_32_view = LittleEndian.getShort(data, 0x52 + offset);
field_33_docinfo4 = LittleEndian.getInt(data, 0x54 + offset);
field_34_adt = LittleEndian.getShort(data, 0x58 + offset);
field_35_doptypography = LittleEndian.getByteArray(data, 0x5a + offset,310);
field_36_dogrid = LittleEndian.getByteArray(data, 0x190 + offset,10);
field_37_docinfo5 = LittleEndian.getShort(data, 0x19a + offset);
field_38_docinfo6 = LittleEndian.getShort(data, 0x19c + offset);
field_39_asumyi = LittleEndian.getByteArray(data, 0x19e + offset,12);
field_40_cChWS = LittleEndian.getInt(data, 0x1aa + offset);
field_41_cChWSFtnEdn = LittleEndian.getInt(data, 0x1ae + offset);
field_42_grfDocEvents = LittleEndian.getInt(data, 0x1b2 + offset);
field_43_virusinfo = LittleEndian.getInt(data, 0x1b6 + offset);
field_44_Spare = LittleEndian.getByteArray(data, 0x1ba + offset,30);
field_45_reserved1 = LittleEndian.getInt(data, 0x1d8 + offset);
field_46_reserved2 = LittleEndian.getInt(data, 0x1dc + offset);
field_47_cDBC = LittleEndian.getInt(data, 0x1e0 + offset);
field_48_cDBCFtnEdn = LittleEndian.getInt(data, 0x1e4 + offset);
field_49_reserved = LittleEndian.getInt(data, 0x1e8 + offset);
field_50_nfcFtnRef = LittleEndian.getShort(data, 0x1ec + offset);
field_51_nfcEdnRef = LittleEndian.getShort(data, 0x1ee + offset);
field_52_hpsZoonFontPag = LittleEndian.getShort(data, 0x1f0 + offset);
field_53_dywDispPag = LittleEndian.getShort(data, 0x1f2 + offset);
}
示例15: fillFields
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
protected void fillFields( byte[] data, int offset )
{
field_1_itl = LittleEndian.getShort( data, 0x0 + offset );
field_2_tlp_flags = data[0x2 + offset];
}