本文整理了Java中com.thomsonreuters.upa.codec.Buffer
类的一些代码示例,展示了Buffer
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer
类的具体详情如下:
包路径:com.thomsonreuters.upa.codec.Buffer
类名称:Buffer
[英]UPA Buffer represents some type of user-provided content along with the content's length.
Used by data encoder/decoder and message packages. The Buffer
has a position and length. When accessing the backing data, use Buffer#position() for the position and Buffer#length() for the length, not the position and limit of the ByteBuffer returned from #data().Blank buffers are conveyed as a Buffer#length()of 0.
Buffer can:
Buffer
具有位置和长度。访问备份数据时,使用Buffer#position()表示位置,使用Buffer#length()表示长度,而不是从#data()返回的ByteBuffer的位置和限制。空白缓冲区作为0的缓冲区#length()传输。代码示例来源:origin: Refinitiv/Elektron-SDK
public void dictionaryName(Buffer dictionaryName)
{
assert (dictionaryName != null) : "dictionaryName can not be null";
this.dictionaryName.data(dictionaryName.data(), dictionaryName.position(), dictionaryName.length());
}
代码示例来源:origin: Refinitiv/Elektron-SDK
@Override
public void clear()
{
_name.clear();
_dataType = 0;
_encodedData.clear();
}
代码示例来源: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
@Override
public String string()
{
if (_rsslBuffer.length() == 0)
return DataImpl.EMPTY_STRING;
else
return _rsslBuffer.toString();
}
代码示例来源:origin: Refinitiv/Elektron-SDK
static void copy(Buffer srcBuffer, Buffer destBuffer)
{
ByteBuffer destByteBuffer = destBuffer.data();
int srcBufferlength = srcBuffer.length();
if ( destByteBuffer == null || destBuffer.capacity() < srcBufferlength)
destByteBuffer = ByteBuffer.allocate(srcBufferlength);
else
destByteBuffer.clear();
ByteBuffer srcByteBuffer = srcBuffer.data();
int limit = srcBuffer.position() + srcBuffer.length();
for (int index = srcBuffer.position(); index < limit; ++index)
destByteBuffer.put(srcByteBuffer.get(index));
destByteBuffer.flip();
destBuffer.data(destByteBuffer);
}
代码示例来源: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
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
@Override
public String enumRecordTemplateVersion() {
return rsslDataDictionary.infoEnumRTVersion().data() != null ? rsslDataDictionary.infoEnumRTVersion().toString() : "";
}
代码示例来源: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
/**
* 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
_tempBuffer1.clear();
_tempByteBuffer1.clear();
_tempBuffer1.data(_tempByteBuffer1);
_tempByteBuffer1 = ByteBuffer.allocate(_tempBuffer1.capacity() * 2 );
_tempBuffer1.clear();
_tempBuffer1.data(_tempByteBuffer1);
_eIter.clear();
_eIter.setBufferAndRWFVersion(_tempBuffer1, Codec.majorVersion(), Codec.minorVersion());
代码示例来源:origin: Refinitiv/Elektron-SDK
@Override
public int encode(EncodeIterator iter, Buffer data)
{
if ((data == null) || (data.length() == 0))
{
_encodedData.clear();
return Encoders.encodeArrayEntry(iter, _encodedData);
}
return Encoders.encodeArrayEntry(iter, data);
}
代码示例来源:origin: Refinitiv/Elektron-SDK
@Override
public String name()
{
return ((_rsslDictionaryEntry == null) ? DataImpl.EMPTY_STRING : (_rsslDictionaryEntry.acronym().toString()));
}
代码示例来源: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
static void reallocate(com.thomsonreuters.upa.codec.EncodeIterator encodeIter, int newLength)
{
if ( ( encodeIter.buffer() != null ) && ( encodeIter.buffer().capacity() >= newLength ) )
{
return;
}
Buffer bigBuffer = CodecFactory.createBuffer();
bigBuffer.data(ByteBuffer.allocate(newLength));
encodeIter.setBufferAndRWFVersion(bigBuffer, com.thomsonreuters.upa.codec.Codec.majorVersion(),
com.thomsonreuters.upa.codec.Codec.minorVersion());
}
代码示例来源:origin: Refinitiv/Elektron-SDK
@Override
void decode(com.thomsonreuters.upa.codec.Buffer rsslBuffer, com.thomsonreuters.upa.codec.DecodeIterator dIter)
{
if (_rsslBuffer.decode(dIter) == CodecReturnCodes.SUCCESS)
_dataCode = DataCode.NO_CODE;
else
_dataCode = DataCode.BLANK;
}
}
代码示例来源: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
public static void setRsslData(Buffer bufEncoded, Data dataEncoded)
{
((DataImpl)dataEncoded).encodedData().copy(bufEncoded);
}
代码示例来源:origin: Refinitiv/Elektron-SDK
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
代码示例来源:origin: Refinitiv/Elektron-SDK
@Override
public String string()
{
if (_rsslBuffer.length() == 0)
return DataImpl.EMPTY_STRING;
else
return _rsslBuffer.toString();
}
内容来源于网络,如有侵权,请联系作者删除!