本文整理了Java中com.esotericsoftware.kryo.io.Input.limit()
方法的一些代码示例,展示了Input.limit()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Input.limit()
方法的具体详情如下:
包路径:com.esotericsoftware.kryo.io.Input
类名称:Input
方法名:limit
[英]Returns the limit for the buffer.
[中]返回缓冲区的限制。
代码示例来源:origin: org.gradle/gradle-messaging
@Override
protected long maybeSkip(long count) throws IOException {
// Work around some bugs in Input.skip()
int remaining = input.limit() - input.position();
if (remaining == 0) {
long skipped = inputStream.skip(count);
if (skipped > 0) {
extraSkipped += skipped;
}
return skipped;
} else if (count <= remaining) {
input.setPosition(input.position() + (int) count);
return count;
} else {
input.setPosition(input.limit());
return remaining;
}
}
代码示例来源:origin: inspectIT/inspectIT
/**
* Returns if the input has more bytes that Kryo can read. This method will first check if any
* bytes are left to read in the Input's internal buffer. If no bytes are left there, will check
* the underlying input stream if the amount of available bytes is more than zero.
*
* @param input
* {@link Input}
* @return True if there is at least 1 bytes to read, false otherwise.
* @throws IOException
* If {@link IOException} occurs on the Input's input stream.
*/
public static boolean hasMoreBytes(Input input) throws IOException {
if (input.limit() > input.position()) {
return true;
} else {
return (null != input.getInputStream()) && (input.getInputStream().available() > 0);
}
}
}
代码示例来源:origin: org.apache.apex/apex-engine
try {
input.setBuffer(dspair.state.buffer, dspair.state.offset, dspair.state.length);
while (input.position() < input.limit()) {
ClassIdPair pair = (ClassIdPair)readClassAndObject(input);
classResolver.registerExplicit(pair);
代码示例来源:origin: org.apache.apex/malhar-library
@Override
public Slice deserialize(Input input)
{
if (input.getInputStream() != null) {
// The input is backed by a stream, cannot directly use its internal buffer
try {
return new Slice(input.readBytes(input.available()));
} catch (IOException ex) {
throw Throwables.propagate(ex);
}
} else {
return new Slice(input.getBuffer(), input.position(), input.limit() - input.position());
}
}
}
内容来源于网络,如有侵权,请联系作者删除!