本文整理汇总了Java中org.apache.poi.util.LittleEndian.putInt方法的典型用法代码示例。如果您正苦于以下问题:Java LittleEndian.putInt方法的具体用法?Java LittleEndian.putInt怎么用?Java LittleEndian.putInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.poi.util.LittleEndian
的用法示例。
在下文中一共展示了LittleEndian.putInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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
};
}
示例2: write
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
public void write(OutputStream out) throws IOException {
byte[] header = new byte[34];
int pos = 0;
LittleEndian.putInt(header, pos, wmfsize); pos += LittleEndian.INT_SIZE; //hmf
LittleEndian.putInt(header, pos, bounds.x); pos += LittleEndian.INT_SIZE; //left
LittleEndian.putInt(header, pos, bounds.y); pos += LittleEndian.INT_SIZE; //top
LittleEndian.putInt(header, pos, bounds.x + bounds.width); pos += LittleEndian.INT_SIZE; //right
LittleEndian.putInt(header, pos, bounds.y + bounds.height); pos += LittleEndian.INT_SIZE; //bottom
LittleEndian.putInt(header, pos, size.width); pos += LittleEndian.INT_SIZE; //inch
LittleEndian.putInt(header, pos, size.height); pos += LittleEndian.INT_SIZE; //inch
LittleEndian.putInt(header, pos, zipsize); pos += LittleEndian.INT_SIZE; //inch
header[pos] = 0; pos ++;
header[pos] = (byte)filter; pos ++;
out.write(header);
}
示例3: 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;
}
示例4: StyleTextPropAtom
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
/**
* A new set of text style properties for some text without any.
*/
public StyleTextPropAtom(int parentTextSize) {
_header = new byte[8];
rawContents = new byte[0];
reserved = new byte[0];
// Set our type
LittleEndian.putInt(_header,2,(short)_type);
// Our initial size is 10
LittleEndian.putInt(_header,4,10);
// Set empty paragraph and character styles
paragraphStyles = new LinkedList<TextPropCollection>();
charStyles = new LinkedList<TextPropCollection>();
TextPropCollection defaultParagraphTextProps =
new TextPropCollection(parentTextSize, (short)0);
paragraphStyles.add(defaultParagraphTextProps);
TextPropCollection defaultCharacterTextProps =
new TextPropCollection(parentTextSize);
charStyles.add(defaultCharacterTextProps);
// Set us as now initialised
initialised = true;
}
示例5: 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 );
}
示例6: serialize
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
public void serialize( byte[] data, int offset )
{
LittleEndian.putInt( data, 0x0 + offset, field_1_iStartAt );
data[ 0x4 + offset ] = field_2_nfc;
data[ 0x5 + offset ] = field_3_info;
System.arraycopy( field_4_rgbxchNums, 0, data, 0x6 + offset, field_4_rgbxchNums.length );
data[ 0xf + offset ] = field_5_ixchFollow;
LittleEndian.putInt( data, 0x10 + offset, field_6_dxaIndentSav );
LittleEndian.putInt( data, 0x14 + offset, field_7_unused2 );
LittleEndian.putUByte( data, 0x18 + offset, field_8_cbGrpprlChpx );
LittleEndian.putUByte( data, 0x19 + offset, field_9_cbGrpprlPapx );
LittleEndian.putUByte( data, 0x1a + offset, field_10_ilvlRestartLim );
field_11_grfhic.serialize( data, 0x1b + offset );
}
示例7: addBMPHeader
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
public static byte[] addBMPHeader(byte[] data){
// bitmap file-header, corresponds to a
// Windows BITMAPFILEHEADER structure
// (For more information, consult the Windows API Programmer's reference )
byte[] header = new byte[HEADER_SIZE];
//Specifies the file type. It must be set to the signature word BM (0x4D42) to indicate bitmap.
LittleEndian.putInt(header, 0, 0x4D42);
// read the size of the image and calculate the overall file size
// and the offset where the bitmap starts
int imageSize = LittleEndian.getInt(data, 0x22 - HEADER_SIZE);
int fileSize = data.length + HEADER_SIZE;
int offset = fileSize - imageSize;
// specifies the size, in bytes, of the bitmap file - must add the length of the header
LittleEndian.putInt(header, 2, fileSize);
// Reserved; set to zero
LittleEndian.putInt(header, 6, 0);
// the offset, i.e. starting address, of the byte where the bitmap data can be found
LittleEndian.putInt(header, 10, offset);
//DIB data is the header + dib bytes
byte[] dib = new byte[header.length + data.length];
System.arraycopy(header, 0, dib, 0, header.length);
System.arraycopy(data, 0, dib, header.length, data.length);
return dib;
}
示例8: buildFromUnknownEscherRecord
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
protected Record buildFromUnknownEscherRecord(UnknownEscherRecord unknown) {
byte[] bingo = unknown.getData();
byte[] restoredRecord = new byte[8 + bingo.length];
System.arraycopy(bingo, 0, restoredRecord, 8, bingo.length);
short recordVersion = unknown.getVersion();
short recordId = unknown.getRecordId();
int recordLength = unknown.getRecordSize();
LittleEndian.putShort(restoredRecord, 0, recordVersion);
LittleEndian.putShort(restoredRecord, 2, recordId);
LittleEndian.putInt(restoredRecord, 4, recordLength);
return Record.createRecordForType(recordId, restoredRecord, 0, restoredRecord.length);
}
示例9: setText
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
/** Updates the text in the Atom. Must be 8 bit ascii */
public void setText(byte[] b) {
// Set the text
_text = b;
// Update the size (header bytes 5-8)
LittleEndian.putInt(_header,4,_text.length);
}
示例10: writeTo
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
void writeTo( HWPFOutputStream tableStream ) throws IOException
{
LittleEndian.putInt( _cp, tableStream );
for ( ListFormatOverrideLevel lfolvl : _rgLfoLvl )
{
tableStream.write( lfolvl.toByteArray() );
}
}
示例11: toByteArray
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
public byte[] toByteArray()
{
int offset = 0;
byte[] buf = new byte[12];
LittleEndian.putShort(buf, offset, fn);
offset += LittleEndian.SHORT_SIZE;
LittleEndian.putInt(buf, offset, fcSepx);
offset += LittleEndian.INT_SIZE;
LittleEndian.putShort(buf, offset, fnMpr);
offset += LittleEndian.SHORT_SIZE;
LittleEndian.putInt(buf, offset, fcMpr);
return buf;
}
示例12: Comment2000Atom
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
/**
* Constructs a brand new comment atom record.
*/
protected Comment2000Atom() {
_header = new byte[8];
_data = new byte[28];
LittleEndian.putShort(_header, 2, (short)getRecordType());
LittleEndian.putInt(_header, 4, _data.length);
// It is fine for the other values to be zero
}
示例13: SoundData
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
/**
* Constructs a new empty sound container.
*/
protected SoundData() {
_header = new byte[8];
_data = new byte[0];
LittleEndian.putShort(_header, 2, (short)getRecordType());
LittleEndian.putInt(_header, 4, _data.length);
}
示例14: reset
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
/**
* Reset the content to one info run with the default values
* @param size the site of parent text
*/
public void reset(int size){
_data = new byte[10];
// 01 00 00 00
LittleEndian.putInt(_data, 0, size);
// 01 00 00 00
LittleEndian.putInt(_data, 4, 1); //mask
// 00 00
LittleEndian.putShort(_data, 8, (short)0); //langId
// Update the size (header bytes 5-8)
LittleEndian.putInt(_header, 4, _data.length);
}
示例15: writeOut
import org.apache.poi.util.LittleEndian; //导入方法依赖的package包/类
/**
* Writes ourselves back out
*/
public void writeOut(OutputStream out) throws IOException {
// Decide on the size
// 8 = atom header
// 20 = up to name
// 4 = revision
// 3 * len = ascii + unicode
int size = 8 + 20 + 4 + (3 * lastEditUser.length());
_contents = new byte[size];
// First we have a 8 byte atom header
System.arraycopy(atomHeader,0,_contents,0,4);
// Size is 20+user len + revision len(4)
int atomSize = 20+4+lastEditUser.length();
LittleEndian.putInt(_contents,4,atomSize);
// Now we have the size of the details, which is 20
LittleEndian.putInt(_contents,8,20);
// Now the ppt un-encrypted header token (4 bytes)
System.arraycopy(headerToken,0,_contents,12,4);
// Now the current edit offset
LittleEndian.putInt(_contents,16,(int)currentEditOffset);
// The username gets stored twice, once as US
// ascii, and again as unicode laster on
byte[] asciiUN = new byte[lastEditUser.length()];
StringUtil.putCompressedUnicode(lastEditUser,asciiUN,0);
// Now we're able to do the length of the last edited user
LittleEndian.putShort(_contents,20,(short)asciiUN.length);
// Now the file versions, 2+1+1
LittleEndian.putShort(_contents,22,(short)docFinalVersion);
_contents[24] = docMajorNo;
_contents[25] = docMinorNo;
// 2 bytes blank
_contents[26] = 0;
_contents[27] = 0;
// At this point we have the username as us ascii
System.arraycopy(asciiUN,0,_contents,28,asciiUN.length);
// 4 byte release version
LittleEndian.putInt(_contents,28+asciiUN.length,(int)releaseVersion);
// username in unicode
byte [] ucUN = new byte[lastEditUser.length()*2];
StringUtil.putUnicodeLE(lastEditUser,ucUN,0);
System.arraycopy(ucUN,0,_contents,28+asciiUN.length+4,ucUN.length);
// Write out
out.write(_contents);
}