/** * Construct a new message container from a string representation. * * <p><strong>Note.</strong> This method allocates memory.</p> * * @param s a string representation * @return a message container */ public static FIXMessage fromString(String s) { String[][] fields = Stream.of(s.split("\\|")) .map(field -> field.split("=")) .toArray(String[][]::new); int maxValueLength = Stream.of(fields) .mapToInt(field -> field[1].length()) .max() .orElse(0); FIXMessage message = new FIXMessage(fields.length, maxValueLength + 1); for (String[] field : fields) { int tag = Integer.parseInt(field[0]); String value = field[1]; message.addField(tag).setString(value); } return message; }
/** * Construct a new message container from a string representation. * * <p><strong>Note.</strong> This method allocates memory.</p> * * @param s a string representation * @return a message container */ public static FIXMessage fromString(String s) { String[][] fields = Stream.of(s.split("\\|")) .map(field -> field.split("=")) .toArray(String[][]::new); int maxValueLength = Stream.of(fields) .mapToInt(field -> field[1].length()) .max() .orElse(0); FIXMessage message = new FIXMessage(fields.length, maxValueLength + 1); for (String[] field : fields) { int tag = Integer.parseInt(field[0]); String value = field[1]; message.addField(tag).setString(value); } return message; }
@Setup(Level.Iteration) public void prepare() { message = new FIXMessage(32, 32); format(); buffer = ByteBuffer.allocateDirect(1024); message.put(buffer); buffer.flip(); }
/** * Create a message container. * * @return a message container */ public FIXMessage create() { return new FIXMessage(config.getMaxFieldCount(), config.getFieldCapacity()); }
/** * Create a message container. * * @return a message container */ public FIXMessage create() { return new FIXMessage(config.getMaxFieldCount(), config.getFieldCapacity()); }
/** * Create a message parser. * * @param config the parser configuration * @param listener the message listener */ public FIXMessageParser(FIXConfig config, FIXMessageListener listener) { this.message = new FIXMessage(config.getMaxFieldCount(), config.getFieldCapacity()); this.checkSumEnabled = config.isCheckSumEnabled(); this.listener = listener; this.beginString = new FIXValue(BEGIN_STRING_FIELD_CAPACITY); this.bodyLength = new FIXValue(BODY_LENGTH_FIELD_CAPACITY); this.checkSum = new FIXValue(CHECK_SUM_FIELD_CAPACITY); }
new FIXMessage(config.getMaxFieldCount(), config.getFieldCapacity()), config.isCheckSumEnabled()); this.txMessage = new FIXMessage(config.getMaxFieldCount(), config.getFieldCapacity());
this.txMessage = new FIXMessage(config.getMaxFieldCount(), config.getFieldCapacity());