Class IpcMessageBuilder

java.lang.Object
com._1c.g5.v8.dt.internal.pm.connection.mmf.IpcMessageBuilder

public class IpcMessageBuilder extends Object
Builds IpcMessage from data from buffer.

Reads length of message in bytes from the first 4 bytes of the first append(ByteBuffer), then all remaining bytes from buffer at first and all further append(ByteBuffer) calls until length bytes appended.

  • Constructor Details

    • IpcMessageBuilder

      public IpcMessageBuilder()
  • Method Details

    • append

      public void append(ByteBuffer dataBuffer)
      Appends bytes from given buffer.

      On the first call, reads length of message from the first 4 bytes and appends minimum of remaining and length bytes. On further calls, appends min((length - already appended count), dataBuffer.remaining()) bytes. isCompleted() returns false until length bytes appended, then it returns true.

      Parameters:
      dataBuffer - given data buffer (not null)
    • isCompleted

      public boolean isCompleted()
      Returns if message is completed according to message checker.

      Message is completed if and only if apended count of bytes, excluding the first 4 bytes of the first packet, is equal or greater then message length which read from the first 4 bytes of the first appended packet.

      Returns:
      true if message is completed, false otherwise
    • build

      public IpcMessage build()
      Builds an IpcMessage from all appended data.
      Returns:
      built instance of IpcMessage (not null)