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

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

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

Buffer.equals介绍

[英]Tests if this Buffer is equal to another Buffer. The two objects are equals if they have the same length and the two sequence of elements are equal.

If one buffer is backed by a String and the other buffer is backed by a ByteBuffer, the String will be compared as 8-bit ASCII.
[中]测试此缓冲区是否等于另一个缓冲区。如果两个对象具有相同的长度且两个元素序列相等,则两个对象相等。
如果一个缓冲区由字符串支持,而另一个缓冲区由ByteBuffer支持,则该字符串将作为8位ASCII进行比较。

代码示例

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

private boolean isTextEquals(Buffer thatText)
  {
    if (_text == null && thatText == null)
    {
      return true;
    }
    else if (_text != null)
    {
      return _text.equals(thatText);
    }

    return false;
  }
}

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

/**
 * Retrieves an item info given the item name and domain.
 *
 * @param name - Itemname to search iteminfo for
 * @param domainType - domain type to search iteminfo for
 * @param isPrivateStream the is private stream
 * @return ItemInfo associated with itemName and domainType
 */
public ItemInfo get(Buffer name, int domainType, boolean isPrivateStream)
{
  for (ItemInfo itemInfo : _itemInfoList)
  {
    if (itemInfo.domainType == domainType && name.equals(itemInfo.itemName) 
      && itemInfo.isPrivateStream() == isPrivateStream)
      return itemInfo;
  }
  return null;
}

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

boolean isTokenChange(LoginRequest loginRequest)
{
  return (loginRequest.userNameType() == Login.UserIdTypes.TOKEN || loginRequest.userNameType() == Login.UserIdTypes.AUTHN_TOKEN) &&
      (!loginRequest.userName().equals(_loginRequest.userName()) || !loginRequest.authenticationExtended().equals(_loginRequest.authenticationExtended()));
}

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

if (_triItemName.equals(delItem) || _privateStreamItemName.equals(delItem))
  if (delItem.equals(_symbolListItemWatchList.symbolListItemName(i)))

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

private void processServiceRefresh(List<Service> serviceList, Error error)
{
  for (Service rdmService : serviceList)
  {
    if(rdmService.info().serviceName().toString() != null)
    {
      System.out.println("Received serviceName: " + rdmService.info().serviceName());
    }
    // cache service requested by the application
    if (rdmService.info().serviceName().equals(serviceName))
    {
      rdmService.copy(service);
    }
  }
}

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

if (_triItemName.equals(delItem) || _privateStreamItemName.equals(delItem))
  if (delItem.equals(_symbolListItemWatchList.symbolListItemName(i)))

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

@Test
public void equalsWithStringsTest()
{
  // test RsslBuffers Backed by Strings.
  Buffer buf1 = CodecFactory.createBuffer();
  buf1.data("John Carter");
  Buffer buf2 = CodecFactory.createBuffer();
  assertEquals(CodecReturnCodes.SUCCESS, buf2.data("Tars Tarkas"));
  assertFalse(buf2.equals(buf1));
  assertFalse(buf1.equals(buf2));
  assertEquals(CodecReturnCodes.SUCCESS, buf2.data("Tars A. Tarkas"));
  assertFalse(buf2.equals(buf1));
  assertFalse(buf1.equals(buf2));
  assertEquals(CodecReturnCodes.SUCCESS, buf2.data("John Carter"));
  assertTrue(buf2.equals(buf1));
  assertTrue(buf1.equals(buf2));
  assertTrue(buf2.equals(buf2));
  assertTrue(buf1.equals(buf1));
}

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

void handleItemGroup(ItemInfo itemInfo, Buffer groupId, State state)
{
  if ( ( groupId.length() < 2 ) || ( groupId.data().get(0) == 0 && groupId.data().get(1) == 0 ) 
      || !itemInfo.msgKey().checkHasServiceId() )
  {
    return;
  }
  
  if( itemInfo.hasItemGroup() )
  {
    if ( !groupId.equals(itemInfo.itemGroup() ) )
    {
      updateItemGroup(itemInfo, groupId);
      itemInfo.itemGroup(groupId);
    }
  }
  else
  {
    itemInfo.itemGroup(groupId);
    addItemGroup(itemInfo, groupId);
  }
}

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

assertTrue(buf2.equals(buf1));
assertTrue(buf1.equals(buf2));
assertTrue(buf2.equals(buf2));
assertTrue(buf1.equals(buf1));
assertFalse(buf2.equals(buf1));
assertFalse(buf1.equals(buf2));
assertFalse(buf2.equals(buf1));
assertFalse(buf1.equals(buf2));

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

if (elementEntry.name().equals(ElementNames.DICT_VERSION))
if (elementEntry.name().equals(ElementNames.DICT_TYPE))

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

private void processServiceRefresh(List<Service> serviceList, Error error)
{
  for (Service rdmService : serviceList)
  {
    if (rdmService.action() == MapEntryActions.DELETE && rdmService.serviceId() == service.serviceId() ) 
    {
      service.action(MapEntryActions.DELETE);
    }
    
    if(rdmService.info().serviceName().toString() != null)
    {
      System.out.println("Received serviceName: " + rdmService.info().serviceName());
    }
    // cache service requested by the application
    if (rdmService.info().serviceName().equals(serviceName))
    {
      rdmService.copy(service);
     }
  }        
}

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

if (element.name().equals(ElementNames.CONNECTION_CONFIG))

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

@Test
public void bigBufferTest()
{
  int len = 1024 * 1000; // 1M
  byte[] bArray = new byte[len];
  byte[] bArrayL = new byte[len];
  // load a byte array with a large amount of data.
  byte b = 0x20; // space char
  for (int i = 0; i < len; i++)
  {
    bArray[i] = b;
    bArrayL[i] = (byte)((b > 0x40 && b < 0x5b) ? b + 0x20 : b); // lowercase
                                  // only
    if (++b > 0x7e)
      b = 0x20;
  }
  Buffer buf1 = CodecFactory.createBuffer();
  Buffer buf2 = CodecFactory.createBuffer();
  // compare same buffer
  assertEquals(CodecReturnCodes.SUCCESS,
         buf1.data(ByteBuffer.wrap(bArray), 0, bArray.length));
  assertEquals(CodecReturnCodes.SUCCESS,
         buf2.data(ByteBuffer.wrap(bArray), 0, bArray.length));
  assertTrue(buf2.equals(buf1));
  // compare lower case buffer (b2) to mixed case buffer (b1).
  assertEquals(CodecReturnCodes.SUCCESS,
         buf2.data(ByteBuffer.wrap(bArrayL), 0, bArrayL.length));
  // b2 is lexically greater than b1
  assertFalse(buf2.equals(buf1));
}

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

if (oEntry._acronym.equals(iEntry._acronym) == false)

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

public int decode(DecodeIterator dIter, Msg msg)
{
  clear();
  elementList.clear();
  int ret = elementList.decode(dIter, null);
  if (ret != CodecReturnCodes.SUCCESS)
    return ret;
  boolean warmStandbyModeFound = false;
  while ((ret = elementEntry.decode(dIter)) != CodecReturnCodes.END_OF_CONTAINER)
  {
    if (ret != CodecReturnCodes.SUCCESS)
      return ret;
    if (elementEntry.name().equals(ElementNames.WARMSTANDBY_MODE))
    {
      if (elementEntry.dataType() != DataTypes.UINT)
        return ret;
      ret = tmpUInt.decode(dIter);
      if (ret != CodecReturnCodes.SUCCESS && ret != CodecReturnCodes.BLANK_DATA)
        return ret;
      warmStandbyMode(tmpUInt.toLong());
      warmStandbyModeFound = true;
    }
  }
  if (!warmStandbyModeFound)
    return CodecReturnCodes.FAILURE;
  return CodecReturnCodes.SUCCESS;
}

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

else if (element.name().equals(ElementNames.AUTHN_ERROR_CODE))
  authenticationErrorCode(tmpUInt.toLong());
else if (element.name().equals(ElementNames.AUTHN_ERROR_TEXT))

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

if (checkHasNameType() && (_nameType != thatKey.nameType()))
  return false;
if (checkHasName() && !_name.equals(thatKey.name()))
  return false;
if (checkHasFilter() && (_filter != thatKey.filter()))
  if (!_encodedAttrib.equals(thatKey.encodedAttrib()))
    return false;

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

dictionaryRequest.copy(_dictionaryProvider.dictionaryRequest());
System.out.println("Received Dictionary Request for DictionaryName: " + dictionaryRequest.dictionaryName());
if (_dictionaryProvider.fieldDictionaryDownloadName().equals(dictionaryRequest.dictionaryName()))
else if (_dictionaryProvider.enumTypeDictionaryDownloadName().equals(dictionaryRequest.dictionaryName()))

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

private void bufferED(Buffer buf)
{
  _encIter.clear();
  _buffer.data(ByteBuffer.allocate(15));
  _encIter.setBufferAndRWFVersion(_buffer, Codec.majorVersion(), Codec.minorVersion());
  buf.encode(_encIter);
  _decIter.clear();
  _decIter.setBufferAndRWFVersion(_buffer, Codec.majorVersion(), Codec.minorVersion());
  Buffer buf1 = CodecFactory.createBuffer();
  buf1.data(ByteBuffer.allocate(15));
  buf1.decode(_decIter);
  assertEquals(buf.toString(), buf1.toString());
  assertTrue(buf.equals(buf1));
}

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

static void verifyMessageWithToken(ByteBuffer byteBuffer, int msgClass, int domainType, Buffer token)
{
  System.out.println("ReactorTest.verifyMessageWithToken: checking message for msgClass="
      + MsgClasses.toString(msgClass) + " domain=" + DomainTypes.toString(domainType)
      + "\n");
  stripRipcHeader(byteBuffer);
  Buffer buffer = CodecFactory.createBuffer();
  assertNotNull(buffer);
  buffer.data(byteBuffer);
  DecodeIterator dIter = CodecFactory.createDecodeIterator();
  assertNotNull(dIter);
  dIter.clear();
  assertEquals(CodecReturnCodes.SUCCESS, dIter.setBufferAndRWFVersion(buffer, Codec.majorVersion(), Codec.minorVersion()));
  Msg msg = CodecFactory.createMsg();
  assertNotNull(msg);
  assertEquals(CodecReturnCodes.SUCCESS, msg.decode(dIter));
  assertEquals(msgClass, msg.msgClass());
  assertEquals(domainType, msg.domainType());
  LoginRequest loginRequest = (LoginRequest)LoginMsgFactory.createMsg();
  loginRequest.rdmMsgType(LoginMsgType.REQUEST);
  loginRequest.decode(dIter, msg);
  assertTrue(loginRequest.checkHasUserNameType());
  assertEquals(Login.UserIdTypes.TOKEN, loginRequest.userNameType());
  assertTrue(token.equals(loginRequest.userName()));
}

相关文章