本文整理了Java中com.thomsonreuters.upa.codec.Buffer.capacity()
方法的一些代码示例,展示了Buffer.capacity()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.capacity()
方法的具体详情如下:
包路径:com.thomsonreuters.upa.codec.Buffer
类名称:Buffer
方法名:capacity
[英]Returns the capacity of this buffer. If underlying data is backed by ByteBuffer, capacity is the difference between limit and initial position of the backing ByteBuffer. For String backed buffer, capacity is the string length.
[中]返回此缓冲区的容量。如果基础数据由ByteBuffer支持,则容量是支持ByteBuffer的限制和初始位置之间的差值。对于支持字符串的缓冲区,容量是字符串长度。
代码示例来源: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
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
代码示例来源:origin: Refinitiv/Elektron-SDK
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
while ((ret = rsslMapEntry.encode(_rsslEncodeIter, (com.thomsonreuters.upa.codec.Int)cacheKeyData)) == CodecReturnCodes.BUFFER_TOO_SMALL)
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
代码示例来源:origin: Refinitiv/Elektron-SDK
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
while ((ret = rsslFieldEntry.encode(_rsslEncodeIter, (com.thomsonreuters.upa.codec.Int)cacheEntryData)) == CodecReturnCodes.BUFFER_TOO_SMALL)
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
代码示例来源: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
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
while ((ret = rsslElementEntry.encode(_rsslEncodeIter, (com.thomsonreuters.upa.codec.Int) cacheEntryData)) == CodecReturnCodes.BUFFER_TOO_SMALL)
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
代码示例来源:origin: Refinitiv/Elektron-SDK
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
代码示例来源:origin: Refinitiv/Elektron-SDK
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
代码示例来源:origin: Refinitiv/Elektron-SDK
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
代码示例来源:origin: Refinitiv/Elektron-SDK
/**
* This tests the capacity() method.
*/
@Test
public void getCapacityTest()
{
Buffer buf1 = CodecFactory.createBuffer();
ByteBuffer bb1 = ByteBuffer.allocate(8);
buf1.data(bb1);
//capacity = byte buffer size
assertEquals(buf1.capacity(), 8);
ByteBuffer backingByteBuffer = buf1.data();
for (int i = 0; i < 5; i++)
{
backingByteBuffer.put((byte)(i % 256)); // 0-255
}
//capacity remains the same
assertEquals(buf1.capacity(), 8);
//capacity after new limit
backingByteBuffer.limit(6);
assertEquals(buf1.capacity(), 6);
}
}
代码示例来源:origin: Refinitiv/Elektron-SDK
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
代码示例来源:origin: Refinitiv/Elektron-SDK
encodedBuffer = Utilities.realignBuffer(encodeIt, encodedBuffer.capacity() * 2);
代码示例来源:origin: Refinitiv/Elektron-SDK
bigBuffer.data(ByteBuffer.allocate(_rsslBuffer.capacity() * 2));
_rsslBuffer = bigBuffer;
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
代码示例来源:origin: Refinitiv/Elektron-SDK
bigBuffer.data(ByteBuffer.allocate(_rsslBuffer.capacity() * 2));
_rsslBuffer = bigBuffer;
_rsslBuffer = Utilities.realignBuffer(_rsslEncodeIter, _rsslBuffer.capacity() * 2);
代码示例来源:origin: Refinitiv/Elektron-SDK
_msgBuffer = Utilities.realignBuffer(_encodeIterator, _msgBuffer.capacity() * 2);
代码示例来源:origin: Refinitiv/Elektron-SDK
Utilities.reallocate(seriesImpl._rsslEncodeIter, seriesImpl._rsslEncodeIter.buffer().capacity() * 2);
代码示例来源:origin: Refinitiv/Elektron-SDK
if (decryptedOutput.capacity() < tempLen)
error.text("decryptBuffer() Error: 0020 Cannot fit decrypted output into output buffer of size (" + decryptedOutput.capacity() + ").");
return CodecReturnCodes.BUFFER_TOO_SMALL;
代码示例来源:origin: Refinitiv/Elektron-SDK
if (decryptedOutput.capacity() < tempLen)
error.text("decryptBuffer() Error: 0020 Cannot fit decrypted output into output buffer of size (" + decryptedOutput.capacity() + ").");
return CodecReturnCodes.BUFFER_TOO_SMALL;
代码示例来源:origin: Refinitiv/Elektron-SDK
Utilities.reallocate(seriesImpl._rsslEncodeIter, seriesImpl._rsslEncodeIter.buffer().capacity() * 2);
rsslInt.value(rsslDataDictionary.minFid());
代码示例来源:origin: Refinitiv/Elektron-SDK
_tempByteBuffer1 = ByteBuffer.allocate(_tempBuffer1.capacity() * 2 );
_tempBuffer1.clear();
_tempBuffer1.data(_tempByteBuffer1);
内容来源于网络,如有侵权,请联系作者删除!