[QFJ-298] Send Binary Data Over Fix Created: 27/Feb/08 Updated: 07/Aug/08 Resolved: 18/Jun/08 |
|
Status: | Closed |
Project: | QuickFIX/J |
Component/s: | Engine |
Affects Version/s: | 1.3.1 |
Fix Version/s: | 1.3.2 |
Type: | New Feature | Priority: | Default |
Reporter: | Hiranya Jayathilaka | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Labels: | None | ||
Environment: |
any |
Attachments: | svn_diff.patch |
Description |
Currently the only way to send binary data over FIX is to get the binary data into a String and then call setString() method on the message object passing the string variable as a parameter. Since putting binary data in strings could be error prone it would be better if there was a method (somethine like setBytes(byte[] b)) to directly set a byte array into a message field. |
Comments |
Comment by Hiranya Jayathilaka [ 27/Feb/08 ] |
In fact I think it's best not to allow putting binary data in messages using Strings. Strings are not meant for that kind of work. |
Comment by Hiranya Jayathilaka [ 07/Mar/08 ] |
Attached herewith is a possible solution for the issue. I added a new class called BytesField extending the Field class to support better handling of binary data and added setField(int field, byte[] value), setField(BytesField field) and getField(BytesField field) methods to the FieldMap API. |
Comment by Steve Bate [ 18/Jun/08 ] |
I've added this feature. However, be aware that internally the byte arrays are still being converted to strings. Also, the generated message "data" classes will still be based on StringField for compatibility with QuickFIX JNI. When parsing a message the data fields will be parsed into StringFields. For these reasons the BytesFields usefulness is limited somewhat. The patch has a bug where it was formatting the field using byte[].toString() (in the Field base class) which will not result in a correct FIX message. I've added unit tests that include a test of this functionality. |