Java Code Examples for org.apache.poi.util.StringUtil#getEncodedSize()

The following examples show how to use org.apache.poi.util.StringUtil#getEncodedSize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExternalNameRecord.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected int getDataSize(){
	int result = 2 + 4;  // short and int
       result += StringUtil.getEncodedSize(field_4_name) - 1; //size is byte, not short 

       if(!isOLELink() && !isStdDocumentNameIdentifier()){
           if(isAutomaticLink()){
           	if(_ddeValues != null) {
                   result += 3; // byte, short
                   result += ConstantValueParser.getEncodedSize(_ddeValues);
           	}
           } else {
               result += field_5_name_definition.getEncodedSize();
           }
       }
	return result;
}
 
Example 2
Source File: ConstantValueParser.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @return encoded size without the 'type' code byte
 */
private static int getEncodedSize(Object object) {
	if(object == EMPTY_REPRESENTATION) {
		return 8;
	}
	Class<?> cls = object.getClass();
	
	if(cls == Boolean.class || cls == Double.class || cls == ErrorConstant.class) {
		return 8;
	}
	String strVal = (String)object;
	return StringUtil.getEncodedSize(strVal);
}
 
Example 3
Source File: SupBookRecord.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
protected int getDataSize() {
    if(!isExternalReferences()) {
        return SMALL_RECORD_SIZE;
    }
    int sum = 2; // u16 number of sheets

    sum += StringUtil.getEncodedSize(field_2_encoded_url);

    for(int i=0; i<field_3_sheet_names.length; i++) {
        sum += StringUtil.getEncodedSize(field_3_sheet_names[i]);
    }
    return sum;
}
 
Example 4
Source File: LbsDataSubRecord.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected int getDataSize() {
    int result = 2; // 2 initial shorts

    // optional link formula
    if (_linkPtg != null) {
        result += 2; // encoded Ptg size
        result += 4; // unknown int
        result += _linkPtg.getSize();
        if (_unknownPostFormulaByte != null) {
            result += 1;
        }
    }

    result += 4 * 2; // 4 shorts
    if(_dropData != null) {
        result += _dropData.getDataSize();
    }
    if(_rgLines != null) {
        for(String str : _rgLines){
            result += StringUtil.getEncodedSize(str);
        }
    }
    if(_bsels != null) {
        result += _bsels.length;
    }
    return result;
}
 
Example 5
Source File: LbsDataSubRecord.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public LbsDropData(LittleEndianInput in){
    _wStyle = in.readUShort();
    _cLine = in.readUShort();
    _dxMin = in.readUShort();
    _str = StringUtil.readUnicodeString(in);
    if(StringUtil.getEncodedSize(_str) % 2 != 0){
        _unused = in.readByte();
    }
}
 
Example 6
Source File: LbsDataSubRecord.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public int getDataSize() {
    int size = 6;
    size += StringUtil.getEncodedSize(_str);
    if(_unused != null) {
        size++;
    }
    return size;
}
 
Example 7
Source File: DataItemRecord.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected int getDataSize() {
	return 2 + 2 + 2 + 2 + 2 + 2 + StringUtil.getEncodedSize(name);
}
 
Example 8
Source File: ViewDefinitionRecord.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected int getDataSize() {
	return 40 + // 20 short fields (rwFirst ... itblAutoFmt)
		StringUtil.getEncodedSize(name) + StringUtil.getEncodedSize(dataField) ;
}
 
Example 9
Source File: FeatProtection.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public int getDataSize() {
	return 4 + 4 + StringUtil.getEncodedSize(title) + securityDescriptor.length;
}