Codota Logo
Encoder.encode
Code IndexAdd Codota to your IDE (free)

How to use
encode
method
in
uk.co.real_logic.artio.builder.Encoder

Best Java code snippets using uk.co.real_logic.artio.builder.Encoder.encode (Showing top 13 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: real-logic/artio

@Test
public void canDisableRequiredFloatFieldValidation() throws Exception
{
  final Encoder encoder = (Encoder)heartbeatWithoutValidation.getConstructor().newInstance();
  setOnBehalfOfCompID(encoder);
  setSomeTimeField(encoder, 0);
  encoder.encode(buffer, 1);
}
origin: real-logic/artio

@Test
public void canDisableRequiredStringFieldValidation() throws Exception
{
  final Encoder encoder = (Encoder)heartbeatWithoutValidation.getConstructor().newInstance();
  setFloatField(encoder);
  setSomeTimeField(encoder, 0);
  encoder.encode(buffer, 1);
}
origin: real-logic/artio

@Test
public void canDisableRequiredTemporalFieldValidation() throws Exception
{
  final Encoder encoder = (Encoder)heartbeatWithoutValidation.getConstructor().newInstance();
  setOnBehalfOfCompID(encoder);
  setFloatField(encoder);
  encoder.encode(buffer, 1);
}
origin: real-logic/artio

private void assertEncodesTo(final Encoder encoder, final String expectedValue)
{
  final long result = encoder.encode(buffer, 1);
  final int length = Encoder.length(result);
  final int offset = Encoder.offset(result);
  assertEquals(expectedValue, buffer.getAscii(offset, expectedValue.length()));
  assertEquals(expectedValue.length(), length);
}
origin: real-logic/artio

@Test(expected = EncodingException.class)
public void shouldValidateMissingRequiredStringFields() throws Exception
{
  final Encoder encoder = newHeartbeat();
  setFloatField(encoder);
  setSomeTimeField(encoder, 0);
  encoder.encode(buffer, 1);
}
origin: real-logic/artio

@Test(expected = EncodingException.class)
public void shouldValidateMissingRequiredFloatFields() throws Exception
{
  final Encoder encoder = newHeartbeat();
  setOnBehalfOfCompID(encoder);
  setSomeTimeField(encoder, 0);
  encoder.encode(buffer, 1);
}
origin: real-logic/artio

void send(final Encoder encoder)
{
  try
  {
    final long result = encoder.encode(writeAsciiBuffer, OFFSET);
    final int offset = Encoder.offset(result);
    final int length = Encoder.length(result);
    encoder.reset();
    writeBuffer.position(offset).limit(offset + length);
    final int written = socket.write(writeBuffer);
    assertEquals(length, written);
    DebugLogger.log(FIX_TEST, "> [" + writeAsciiBuffer.getAscii(offset, length) + "]");
    writeBuffer.clear();
  }
  catch (final IOException ex)
  {
    LangUtil.rethrowUnchecked(ex);
  }
}
origin: real-logic/artio

@Test(expected = EncodingException.class)
public void shouldValidateMissingRequiredTemporalFields() throws Exception
{
  final Encoder encoder = newHeartbeat();
  setOnBehalfOfCompID(encoder);
  setFloatField(encoder);
  encoder.encode(buffer, 1);
}
origin: real-logic/artio

@Test
public void shouldEncodeShorterStringsAfterLongerStrings() throws Exception
{
  final Encoder encoder = newHeartbeat();
  setRequiredFields(encoder);
  encoder.encode(buffer, 1);
  setCharSequence(encoder, ON_BEHALF_OF_COMP_ID, "ab");
  assertEncodesTo(encoder, SHORTER_STRING_MESSAGE);
}
origin: real-logic/artio

@Test(expected = EncodingException.class)
public void shouldValidateMissingRequiredIntFields() throws Exception
{
  final Encoder encoder = newHeartbeat();
  setOnBehalfOfCompID(encoder);
  setFloatField(encoder);
  setSomeTimeField(encoder, 1);
  encoder.encode(buffer, 1);
}
origin: real-logic/artio

@Test(expected = EncodingException.class)
public void shouldResetFlagForMissingRequiredIntFields() throws Exception
{
  final Encoder encoder = newHeartbeat();
  setRequiredFields(encoder);
  encoder.reset();
  setOnBehalfOfCompID(encoder);
  setFloatField(encoder);
  setSomeTimeField(encoder, 1);
  encoder.encode(buffer, 1);
}
origin: real-logic/artio

/**
 * Send a message on this session.
 *
 * @param encoder the encoder of the message to be sent
 * @return the position in the stream that corresponds to the end of this message or a negative
 * number indicating an error status.
 * @throws IndexOutOfBoundsException if the encoded message is too large, if this happens consider
 *                                   increasing {@link CommonConfiguration#sessionBufferSize(int)}
 */
public long send(final Encoder encoder)
{
  validateCanSendMessage();
  final int sentSeqNum = newSentSeqNum();
  final HeaderEncoder header = (HeaderEncoder)encoder.header();
  header
    .msgSeqNum(sentSeqNum)
    .sendingTime(timestampEncoder.buffer(), timestampEncoder.encode(time()));
  if (enableLastMsgSeqNumProcessed)
  {
    header.lastMsgSeqNumProcessed(lastMsgSeqNumProcessed);
  }
  if (!header.hasSenderCompID())
  {
    sessionIdStrategy.setupSession(sessionKey, header);
  }
  final long result = encoder.encode(asciiBuffer, 0);
  final int length = Encoder.length(result);
  final int offset = Encoder.offset(result);
  return send(asciiBuffer, offset, length, sentSeqNum, encoder.messageType());
}
origin: real-logic/artio

private void bufferContainsMessage(
  final long sessionId,
  final int sequenceNumber,
  final int sequenceIndex,
  final Encoder exampleMessage,
  final HeaderEncoder header,
  final int messageType)
{
  final UtcTimestampEncoder timestampEncoder = new UtcTimestampEncoder();
  final int timestampLength = timestampEncoder.encode(ORIGINAL_SENDING_EPOCH_MS);
  MutableAsciiBuffer asciiBuffer = new MutableAsciiBuffer(new byte[BIG_BUFFER_LENGTH]);
  header
    .sendingTime(timestampEncoder.buffer(), timestampLength)
    .senderCompID(BUFFER_SENDER)
    .targetCompID(BUFFER_TARGET)
    .msgSeqNum(sequenceNumber);
  final long result = exampleMessage.encode(asciiBuffer, 0);
  logEntryLength = Encoder.length(result);
  final int encodedOffset = Encoder.offset(result);
  asciiBuffer = new MutableAsciiBuffer(asciiBuffer, encodedOffset, logEntryLength);
  bufferContainsMessage(sessionId, sequenceIndex, asciiBuffer, messageType);
}
uk.co.real_logic.artio.builderEncoderencode

Javadoc

Encode the message onto a buffer in FIX tag=value\001 format.

Popular methods of Encoder

  • length
  • offset
  • reset
    Resets the encoder. Sets all the fields back to their uninitialized state.
  • header
  • messageType
  • resetMessage

Popular in Java

  • Reactive rest calls using spring rest template
  • notifyDataSetChanged (ArrayAdapter)
  • addToBackStack (FragmentTransaction)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • StringTokenizer (java.util)
    The string tokenizer class allows an application to break a string into tokens. The tokenization met
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Pattern (java.util.regex)
    A compiled representation of a regular expression. A regular expression, specified as a string, must
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now