This commit is contained in:
Enrique Zamudio
2013-05-13 18:54:44 -05:00
parent 160f780309
commit 2e521c2b6d
8 changed files with 92 additions and 58 deletions
@@ -51,6 +51,7 @@ public class IsoMessage {
/** Flag to enforce secondary bitmap even if empty. */
private boolean forceb2;
private boolean binBitmap;
private boolean forceStringEncoding;
private String encoding = System.getProperty("file.encoding");
/** Creates a new empty message with no values set. */
@@ -96,7 +97,15 @@ public class IsoMessage {
return encoding;
}
/** Sets the string to be sent as ISO header, that is, after the length header but before the message type.
/** Specified whether the variable-length fields should encode their length
* headers using string conversion with the proper character encoding. Default
* is false, which is the old behavior (encoding as ASCII). This is only useful
* for text format. */
public void setForceStringEncoding(boolean flag) {
forceStringEncoding = flag;
}
/** Sets the string to be sent as ISO header, that is, after the length header but before the message type.
* This is useful in case an application needs some custom data in the ISO header of each message (very rare). */
public void setIsoHeader(String value) {
isoHeader = value;
@@ -385,7 +394,7 @@ public class IsoMessage {
IsoValue<?> v = fields[i];
if (v != null) {
try {
v.write(bout, binary);
v.write(bout, binary, forceStringEncoding);
} catch (IOException ex) {
//should never happen, writing to a ByteArrayOutputStream
}