fixes to handle new string type
PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352626 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
70ff48aa8a
commit
b4cfd3c852
@ -95,8 +95,10 @@ public class FieldIterator
|
||||
result = "data[ 0x" + Integer.toHexString(offset) + " + offset ]";
|
||||
else if (javaType.equals("double"))
|
||||
result = "LittleEndian.getDouble(data, 0x" + Integer.toHexString(offset) + " + offset)";
|
||||
else if (javaType.equals("String"))
|
||||
result = "StringUtil.getFromUnicode(data, 0x" + Integer.toHexString(offset) + " + offset,"+ size + ")";
|
||||
else if (javaType.equals("String") && !type.equals("hbstring"))
|
||||
result = "StringUtil.getFromUnicode(data, 0x" + Integer.toHexString(offset) + " + offset,("+ size + "-1)/2)";
|
||||
else if (javaType.equals("String") && type.equals("hbstring"))
|
||||
result = "StringUtil.getFromUnicodeHigh(data, 0x" + Integer.toHexString(offset) + " + offset, ("+ size+"/2))";
|
||||
|
||||
try
|
||||
{
|
||||
@ -126,8 +128,11 @@ public class FieldIterator
|
||||
result = "data[ " + (offset+4) + " + offset ] = " + javaFieldName + ";";
|
||||
else if (javaType.equals("double"))
|
||||
result = "LittleEndian.putDouble(data, " + (offset+4) + " + offset, " + javaFieldName + ");";
|
||||
else if (javaType.equals("ExcelString"))
|
||||
result = "StringUtil.putUncompressedUnicode("+ javaFieldName +", data, 20 + offset);";
|
||||
else if (javaType.equals("String") && !type.equals("hbstring"))
|
||||
result = "StringUtil.putUncompressedUnicode("+ javaFieldName +", data, offset+4);";
|
||||
else if (javaType.equals("String") && type.equals("hbstring"))
|
||||
result = "StringUtil.putUncompressedUnicodeHigh("+ javaFieldName +", data, "+(offset+4)+" + offset);";
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
@ -152,12 +157,12 @@ public class FieldIterator
|
||||
{
|
||||
String javaFieldName = RecordUtil.getFieldName(fieldNumber,fieldName,0);
|
||||
return result + javaFieldName + ".length * 2 + 2";
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
return result + size;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -137,6 +137,9 @@ public class RecordUtil
|
||||
return pad(new StringBuffer("double"), padTo).toString();
|
||||
else if (type.equals("string"))
|
||||
return pad(new StringBuffer("String"), padTo).toString();
|
||||
else if (type.equals("hbstring"))
|
||||
return pad(new StringBuffer("String"), padTo).toString();
|
||||
|
||||
|
||||
return "short"; // if we don't know, default to short
|
||||
}
|
||||
@ -153,6 +156,9 @@ public class RecordUtil
|
||||
result = pad(new StringBuffer("short"), padTo);
|
||||
else if (type.equals("string"))
|
||||
result = pad(new StringBuffer("String"), padTo);
|
||||
else if (type.equals("hbstring"))
|
||||
result = pad(new StringBuffer("HighByteString"), padTo);
|
||||
|
||||
else
|
||||
return "";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user