com.thomsonreuters.upa.codec.Buffer.copy()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中com.thomsonreuters.upa.codec.Buffer.copy()方法的一些代码示例,展示了Buffer.copy()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.copy()方法的具体详情如下:
包路径:com.thomsonreuters.upa.codec.Buffer
类名称:Buffer
方法名:copy

Buffer.copy介绍

[英]Copies this Buffer's data starting at this Buffer's position, for this Buffer's length, into the destBuffer starting at the destBuffer's position.
[中]将此缓冲区的数据从该缓冲区的位置开始复制到此缓冲区的长度,并从destBuffer的位置开始复制到destBuffer中。

代码示例

代码示例来源:origin: Refinitiv/Elektron-SDK

public static void setRsslData(Buffer bufEncoded, Data dataEncoded)
{
  ((DataImpl)dataEncoded).encodedData().copy(bufEncoded);
}

代码示例来源:origin: Refinitiv/Elektron-SDK

/**
 * Sets the status and and name of a symbol list item.
 *
 * @param itemName - the name that the symbol list item will be set to
 * @param itemNum - An index into the symbol list array
 */
public void symbolListItemName(Buffer itemName, int itemNum)
{
  // copy item name buffer
  ByteBuffer byteBuffer = ByteBuffer.allocate(itemName.length());
  itemName.copy(byteBuffer);
  _symbolListItemList.get(itemNum).itemName = itemName;
  _symbolListItemList.get(itemNum).isInUse = true;
}

代码示例来源:origin: Refinitiv/Elektron-SDK

/**
 * Address.
 *
 * @param setAddress the set address
 */
void address(Buffer setAddress)
{
  address.data(ByteBuffer.allocate(setAddress.length()));
  setAddress.copy(address);
}

代码示例来源:origin: Refinitiv/Elektron-SDK

/**
 * Address.
 *
 * @param setAddress the set address
 * @param location the location
 */
void address(Buffer setAddress, int location)
{
  address.add(location, CodecFactory.createBuffer());
  address.get(location).data(ByteBuffer.allocate(setAddress.length()));
  setAddress.copy(address.get(location));
}

代码示例来源:origin: Refinitiv/Elektron-SDK

int componentVersion(Buffer componentVersion)
  {
    assert (componentVersion != null);

    int len = componentVersion.length();
    ByteBuffer backingBuffer = ByteBuffer.allocate(componentVersion.length());

    int ret = componentVersion.copy(backingBuffer);
    if (ret != TransportReturnCodes.SUCCESS)
      return ret;

    _componentVersion.data(backingBuffer, 0, len);

    return TransportReturnCodes.SUCCESS;
  }
}

代码示例来源:origin: Refinitiv/Elektron-SDK

itemName.copy(byteBuffer);
tmpItemInfo.itemName.data(byteBuffer);
tmpItemInfo.domainType = domainType;

代码示例来源:origin: Refinitiv/Elektron-SDK

/** Allocates memory in destination buffer and performs buffer copy. */
private void createBufferCopy(Buffer srcBuffer, Buffer destBuffer)
{
  destBuffer.data(ByteBuffer.allocateDirect(srcBuffer.length()));
  assertEquals(CodecReturnCodes.SUCCESS, srcBuffer.copy(destBuffer.data()));
}

代码示例来源:origin: Refinitiv/Elektron-SDK

@Test
public void copyByteBufferTest()
{
  Buffer buf1 = CodecFactory.createBuffer();
  ByteBuffer bb1 = ByteBuffer.allocate(10);
  ByteBuffer bb2 = ByteBuffer.allocate(10);
  // test with no backing data in RsslBuffer.
  assertEquals(CodecReturnCodes.SUCCESS, buf1.copy(bb2));
  // test copy with ByteBuffer as backing.
  bb1.putLong(0x0123456798765432L);
  assertEquals(CodecReturnCodes.SUCCESS, buf1.data(bb1, 0, 8));
  assertEquals(CodecReturnCodes.SUCCESS, buf1.copy(bb2));
  assertEquals(0x0123456798765432L, bb2.getLong());
  // test with null destBuffer
  assertEquals(CodecReturnCodes.INVALID_ARGUMENT, buf1.copy((ByteBuffer)null));
  // test with a dest ByteBuffer that is too small.
  int origLimit = bb2.limit();
  bb2.limit(5);
  assertEquals(CodecReturnCodes.BUFFER_TOO_SMALL, buf1.copy(bb2));
  bb2.limit(origLimit);
  // test with backing length = 0.
  assertEquals(CodecReturnCodes.SUCCESS, buf1.data(bb1, 0, 0));
  // test copy with String as backing.
  assertEquals(CodecReturnCodes.SUCCESS, buf1.data("Abcdefghij"));
  bb2.position(0);
  assertEquals(CodecReturnCodes.SUCCESS, buf1.copy(bb2));
  assertEquals(0x4162636465666768L, bb2.getLong());
  assertEquals(0x696a, bb2.getShort());
}

代码示例来源:origin: Refinitiv/Elektron-SDK

public int copy(DictionaryRequest destRequestMsg)
{
  assert (destRequestMsg != null) : "destRequestMsg can not be null";
  destRequestMsg.streamId(streamId());
  destRequestMsg.serviceId(serviceId());
  destRequestMsg.verbosity(verbosity());
  ByteBuffer byteBuffer = ByteBuffer.allocate(this.dictionaryName.length());
  this.dictionaryName.copy(byteBuffer);
  destRequestMsg.dictionaryName().data(byteBuffer);
  if (checkStreaming())
  {
    destRequestMsg.applyStreaming();
  }
  return CodecReturnCodes.SUCCESS;
}

代码示例来源:origin: Refinitiv/Elektron-SDK

/**
 * Performs a deep copy of {@link ServerInfo} object.
 * 
 * @param destServerInfo ServerInfo object to copy this object into. It
 *            cannot be null.
 * 
 * @return UPA return value indicating success or failure of copy
 *         operation.
 */
public int copy(ServerInfo destServerInfo)
{
  assert (destServerInfo != null) : "destServerInfo can not be null";
  destServerInfo.flags(flags);
  ByteBuffer byteBuffer = ByteBuffer.allocate(hostName.length());
  hostName.copy(byteBuffer);
  destServerInfo.hostName().data(byteBuffer);
  destServerInfo.port(port);
  destServerInfo.serverIndex(serverIndex);
  if (checkHasLoadFactor())
    destServerInfo.loadFactor(loadFactor);
  if (checkHasType())
    destServerInfo.serverType(serverType);
  return CodecReturnCodes.SUCCESS;
}

代码示例来源:origin: Refinitiv/Elektron-SDK

private int copyMsgKey(MsgKey destKey, MsgKey sourceKey)
{
  destKey.flags(sourceKey.flags());
  destKey.nameType(sourceKey.nameType());
  if (sourceKey.checkHasName() && sourceKey.name() != null)
  {
    destKey.name().data(ByteBuffer.allocate(sourceKey.name().length()));
    sourceKey.name().copy(destKey.name());
  }
  destKey.serviceId(sourceKey.serviceId());
  destKey.filter(sourceKey.filter());
  destKey.identifier(sourceKey.identifier());
  destKey.attribContainerType(sourceKey.attribContainerType());
  if (sourceKey.checkHasAttrib() && sourceKey.encodedAttrib() != null)
  {
    int ret = sourceKey.encodedAttrib().copy(destKey.encodedAttrib());
    if (ret != CodecReturnCodes.SUCCESS)
      return ret;
  }
  return CodecReturnCodes.SUCCESS;
}

代码示例来源:origin: Refinitiv/Elektron-SDK

private int copyMsgKey(MsgKey destKey, MsgKey sourceKey)
{
  destKey.flags(sourceKey.flags());
  destKey.nameType(sourceKey.nameType());
  if (sourceKey.checkHasName() && sourceKey.name() != null)
  {
    destKey.name().data(ByteBuffer.allocate(sourceKey.name().length()));
    sourceKey.name().copy(destKey.name());
  }
  destKey.serviceId(sourceKey.serviceId());
  destKey.filter(sourceKey.filter());
  destKey.identifier(sourceKey.identifier());
  destKey.attribContainerType(sourceKey.attribContainerType());
  if (sourceKey.checkHasAttrib() && sourceKey.encodedAttrib() != null)
  {
    int ret = sourceKey.encodedAttrib().copy(destKey.encodedAttrib());
    if (ret != CodecReturnCodes.SUCCESS)
      return ret;
  }
  return CodecReturnCodes.SUCCESS;
}

代码示例来源:origin: Refinitiv/Elektron-SDK

/**
 * Performs an update of {@link ServiceData} object.
 *
 * @param destServiceData ServiceData object to update with information from this object. It cannot be null.
 * 
 * @return UPA return value indicating success or failure of update operation.
 */
public int update(ServiceData destServiceData)
{
  assert (destServiceData != null) : "destServiceData can not be null";
  destServiceData.action(action());
  destServiceData.type(type());
  destServiceData.flags(flags());
  if (checkHasData())
  {
    destServiceData.applyHasData();
    destServiceData.dataType(dataType());
    ByteBuffer byteBuffer = ByteBuffer.allocate(data().length());
    data().copy(byteBuffer);
    destServiceData.data().data(byteBuffer);
  }
  return CodecReturnCodes.SUCCESS;
}

代码示例来源:origin: Refinitiv/Elektron-SDK

/**
 * Performs a deep copy of {@link ServiceData} object.
 *
 * @param destServiceData ServiceData object to copy this object into. It cannot be null.
 * 
 * @return UPA return value indicating success or failure of copy operation.
 */
public int copy(ServiceData destServiceData)
{
  assert (destServiceData != null) : "destServiceData can not be null";
  destServiceData.clear();
  destServiceData.action(action());
  destServiceData.type(type());
  destServiceData.flags(flags());
  if (checkHasData())
  {
    destServiceData.applyHasData();
    destServiceData.dataType(dataType());
    ByteBuffer byteBuffer = ByteBuffer.allocate(data().length());
    data().copy(byteBuffer);
    destServiceData.data().data(byteBuffer);
  }
  return CodecReturnCodes.SUCCESS;
}

代码示例来源:origin: Refinitiv/Elektron-SDK

queueName.copy(_queueName);

代码示例来源:origin: Refinitiv/Elektron-SDK

/**
 * Performs a deep copy of {@link ServiceLink} object.
 *
 * @param destServiceLink ServiceLink object to copy this object into. It cannot be null.
 * 
 * @return UPA return value indicating success or failure of copy operation.
 */
public int copy(ServiceLink destServiceLink)
{
  assert (destServiceLink != null) : "destServiceLink can not be null";
  if (checkHasCode())
  {
    destServiceLink.applyHasCode();
    destServiceLink.linkCode(linkCode());
  }
  if (checkHasText())
  {
    destServiceLink.applyHasText();
    ByteBuffer byteBuffer = ByteBuffer.allocate(text().length());
    text().copy(byteBuffer);
    destServiceLink.text().data(byteBuffer);
  }
  if (checkHasType())
  {
    destServiceLink.applyHasType();
    destServiceLink.type(type());
  }
  destServiceLink.linkState(linkState());
  return CodecReturnCodes.SUCCESS;
}

代码示例来源:origin: Refinitiv/Elektron-SDK

/**
 * Fully copies a {@link MarketPriceStatus}.
 * 
 * @param destStatusMsg The resulting copy of the RDM Market price Status
 * 
 * @return UPA return value
 */
public int copy(MarketPriceStatus destStatusMsg)
{
  destStatusMsg.streamId(streamId());
  if(checkHasState())
  {
    destStatusMsg.state().streamState(this.state.streamState());
    destStatusMsg.state().dataState(this.state.dataState());
    destStatusMsg.state().code(this.state.code());
    if(this.state.text().length() >  0)
    {
      ByteBuffer byteBuffer = ByteBuffer.allocate(this.state.text().length());
      this.state.text().copy(byteBuffer);
      destStatusMsg.state().text().data(byteBuffer);
    }    
    destStatusMsg.applyHasState();
  }
  
    return CodecReturnCodes.SUCCESS;
}

代码示例来源:origin: Refinitiv/Elektron-SDK

public int copy(DictionaryStatus destStatusMsg)
{
  assert (destStatusMsg != null) : "destStatusMsg must be non-null";
  destStatusMsg.streamId(streamId());
  if (checkClearCache())
  {
    destStatusMsg.applyClearCache();
  }
  if (checkHasState())
  {
    destStatusMsg.state().streamState(this.state.streamState());
    destStatusMsg.state().dataState(this.state.dataState());
    destStatusMsg.state().code(this.state.code());
    if (this.state.text().length() > 0)
    {
      Buffer stateText = CodecFactory.createBuffer();
      ByteBuffer byteBuffer = ByteBuffer.allocate(this.state.text().length());
      this.state.text().copy(byteBuffer);
      stateText.data(byteBuffer);
      destStatusMsg.state().text(stateText);
    }
    int flags = destStatusMsg.flags();
    flags |= DictionaryStatusFlags.HAS_STATE;
    destStatusMsg.flags(flags);
  }
  return CodecReturnCodes.SUCCESS;
}

代码示例来源:origin: Refinitiv/Elektron-SDK

this.state.text().copy(byteBuffer);
stateText.data(byteBuffer);
destStatusMsg.state().text(stateText);

代码示例来源:origin: Refinitiv/Elektron-SDK

status().text().copy(byteBuffer);
destServiceState.status().text().data(byteBuffer);

相关文章