mirror of https://github.com/apache/poi.git
added support for in-lined test data
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352619 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2e5c84d389
commit
776bf1c737
|
@ -54,12 +54,13 @@
|
|||
|
||||
package org.apache.poi.generator;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* Helper functions for the record transformations. TODO: Change this to
|
||||
* javascript in the style sheet.
|
||||
* Helper functions for the record transformations.
|
||||
*
|
||||
* @author Glen Stampoultzis (glens at apache.org)
|
||||
* @author Andrew C. Oliver (acoliver at apache dot org)
|
||||
*/
|
||||
public class RecordUtil
|
||||
{
|
||||
|
@ -177,5 +178,22 @@ public class RecordUtil
|
|||
pad(fieldName, padTo);
|
||||
return fieldName.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return a byte array formatted string from a HexDump formatted string
|
||||
* for example (byte)0x00,(byte)0x01 instead of 00 01
|
||||
*/
|
||||
public static String getByteArrayString(String data) {
|
||||
StringTokenizer tokenizer = new StringTokenizer(data);
|
||||
StringBuffer retval = new StringBuffer();
|
||||
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
retval.append("(byte)0x").append(tokenizer.nextToken());
|
||||
if (tokenizer.hasMoreTokens()) {
|
||||
retval.append(",");
|
||||
}
|
||||
}
|
||||
return retval.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue