Tabnine Logo
Encoder.encode
Code IndexAdd Tabnine 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)

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
  • addToBackStack (FragmentTransaction)
  • getContentResolver (Context)
  • getApplicationContext (Context)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Reference (javax.naming)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now