@Test public void testGetBytes() throws Exception { ISOMsg m = new ISOMsg("0800"); m.set (3, "000000"); m.set (52, "CAFEBABE".getBytes()); m.set ("63.2.3", "Field 63.2.3"); m.set ("63.2.4", m.getBytes (52)); assertEquals ("000000", m.getString (3)); assertEquals ("000000", new String(m.getBytes(3))); assertEquals ("CAFEBABE", new String(m.getBytes(52))); assertEquals ("Field 63.2.3", m.getString ("63.2.3")); assertEquals ("CAFEBABE", new String(m.getBytes("63.2.4"))); }
public byte[] getBytes (int fldno) { byte[] b = null; if (hasField (fldno)) { Object obj = getValue(fldno); if (obj instanceof String) b = ((String) obj).getBytes(ISOUtil.CHARSET); else if (obj instanceof byte[]) b = (byte[]) obj; } return b; }
ISOMsg extends ISOComponent implements Cloneable, Loggeable, Externalizable { public byte[] getBytes (int fldno) { byte[] b = null; if (hasField (fldno)) { Object obj = getValue(fldno); if (obj instanceof String) b = ((String) obj).getBytes(ISOUtil.CHARSET); else if (obj instanceof byte[]) b = (byte[]) obj; } return b; } }
ISOMsg extends ISOComponent implements Cloneable, Loggeable, Externalizable { public byte[] getBytes (int fldno) { byte[] b = null; if (hasField (fldno)) { Object obj = getValue(fldno); if (obj instanceof String) b = ((String) obj).getBytes(ISOUtil.CHARSET); else if (obj instanceof byte[]) b = (byte[]) obj; } return b; } ISOMsg();  ISOMsg(int fieldNumber); @SuppressWarnings("PMD.EmptyCatchBlock")  ISOMsg(String mti); }
ISOMsg extends ISOComponent implements Cloneable, Loggeable, Externalizable { public byte[] getBytes (int fldno) { byte[] b = null; if (hasField (fldno)) { Object obj = getValue(fldno); if (obj instanceof String) b = ((String) obj).getBytes(ISOUtil.CHARSET); else if (obj instanceof byte[]) b = (byte[]) obj; } return b; } ISOMsg();  ISOMsg(int fieldNumber); @SuppressWarnings("PMD.EmptyCatchBlock")  ISOMsg(String mti); @Override void setFieldNumber(int fieldNumber); void setDirection(int direction); void setHeader(byte[] b); void setHeader(ISOHeader header); byte[] getHeader(); void setTrailer(byte[] trailer); byte[] getTrailer(); ISOHeader getISOHeader(); int getDirection(); boolean isIncoming(); boolean isOutgoing(); @Override int getMaxField(); void setPackager(ISOPackager p); ISOPackager getPackager(); void set(ISOComponent c); void set(int fldno, String value); void set(String fpath, String value); void set(String fpath, ISOComponent c); void set(String fpath, byte[] value); void set(int fldno, byte[] value); @Override void unset(int fldno); void unset(int ... flds); void unset(String fpath); void unset(String ... fpaths); @Override ISOComponent getComposite(); void recalcBitMap(); @Override Map getChildren(); @Override byte[] pack(); @Override int unpack(byte[] b); @Override void unpack(InputStream in); @Override void dump(PrintStream p, String indent); ISOComponent getComponent(int fldno); Object getValue(int fldno); Object getValue(String fpath); ISOComponent getComponent(String fpath); String getString(int fldno); String getString(String fpath); byte[] getBytes(int fldno); byte[] getBytes(String fpath); boolean hasField(int fldno); boolean hasFields(int[] fields); boolean hasAny(int[] fields); boolean hasAny(String... fields); boolean hasField(String fpath); boolean hasFields(); @Override void setValue(Object obj); @Override Object clone(); @SuppressWarnings("PMD.EmptyCatchBlock") Object clone(int ... fields); ISOMsg clone(String ... fpaths); @SuppressWarnings("PMD.EmptyCatchBlock") void merge(ISOMsg m); @Override String toString(); @Override Object getKey(); @Override Object getValue(); boolean isInner(); void setMTI(String mti); void move(int oldFieldNumber, int newFieldNumber); @Override int getFieldNumber(); boolean hasMTI(); String getMTI(); boolean isRequest(); boolean isResponse(); boolean isRetransmission(); void setResponseMTI(); void setRetransmissionMTI(); @Override void writeExternal(ObjectOutput out); @Override void readExternal(ObjectInput in); void setSource(ISOSource source); ISOSource getSource(); }
ISOMsg extends ISOComponent implements Cloneable, Loggeable, Externalizable { public byte[] getBytes (int fldno) { byte[] b = null; if (hasField (fldno)) { Object obj = getValue(fldno); if (obj instanceof String) b = ((String) obj).getBytes(ISOUtil.CHARSET); else if (obj instanceof byte[]) b = (byte[]) obj; } return b; } ISOMsg();  ISOMsg(int fieldNumber); @SuppressWarnings("PMD.EmptyCatchBlock")  ISOMsg(String mti); @Override void setFieldNumber(int fieldNumber); void setDirection(int direction); void setHeader(byte[] b); void setHeader(ISOHeader header); byte[] getHeader(); void setTrailer(byte[] trailer); byte[] getTrailer(); ISOHeader getISOHeader(); int getDirection(); boolean isIncoming(); boolean isOutgoing(); @Override int getMaxField(); void setPackager(ISOPackager p); ISOPackager getPackager(); void set(ISOComponent c); void set(int fldno, String value); void set(String fpath, String value); void set(String fpath, ISOComponent c); void set(String fpath, byte[] value); void set(int fldno, byte[] value); @Override void unset(int fldno); void unset(int ... flds); void unset(String fpath); void unset(String ... fpaths); @Override ISOComponent getComposite(); void recalcBitMap(); @Override Map getChildren(); @Override byte[] pack(); @Override int unpack(byte[] b); @Override void unpack(InputStream in); @Override void dump(PrintStream p, String indent); ISOComponent getComponent(int fldno); Object getValue(int fldno); Object getValue(String fpath); ISOComponent getComponent(String fpath); String getString(int fldno); String getString(String fpath); byte[] getBytes(int fldno); byte[] getBytes(String fpath); boolean hasField(int fldno); boolean hasFields(int[] fields); boolean hasAny(int[] fields); boolean hasAny(String... fields); boolean hasField(String fpath); boolean hasFields(); @Override void setValue(Object obj); @Override Object clone(); @SuppressWarnings("PMD.EmptyCatchBlock") Object clone(int ... fields); ISOMsg clone(String ... fpaths); @SuppressWarnings("PMD.EmptyCatchBlock") void merge(ISOMsg m); @Override String toString(); @Override Object getKey(); @Override Object getValue(); boolean isInner(); void setMTI(String mti); void move(int oldFieldNumber, int newFieldNumber); @Override int getFieldNumber(); boolean hasMTI(); String getMTI(); boolean isRequest(); boolean isResponse(); boolean isRetransmission(); void setResponseMTI(); void setRetransmissionMTI(); @Override void writeExternal(ObjectOutput out); @Override void readExternal(ObjectInput in); void setSource(ISOSource source); ISOSource getSource(); static final int INCOMING; static final int OUTGOING; }