本文整理了Java中org.jgroups.util.Util.computeFragOffsets()
方法的一些代码示例,展示了Util.computeFragOffsets()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.computeFragOffsets()
方法的具体详情如下:
包路径:org.jgroups.util.Util
类名称:Util
方法名:computeFragOffsets
[英]Given a buffer and a fragmentation size, compute a list of fragmentation offset/length pairs, and return them in a list. Example:
Buffer is 10 bytes, frag_size is 4 bytes. Return value will be ({0,4}, {4,4}, {8,2}). This is a total of 3 fragments: the first fragment starts at 0, and has a length of 4 bytes, the second fragment starts at offset 4 and has a length of 4 bytes, and the last fragment starts at offset 8 and has a length of 2 bytes.
[中]给定缓冲区和碎片大小,计算碎片偏移量/长度对的列表,并在列表中返回它们。例子:
缓冲区是10字节,frag_大小是4字节。返回值将是({0,4},{4,4},{8,2})。这一共是3个片段:第一个片段从0开始,长度为4字节,第二个片段从偏移量4开始,长度为4字节,最后一个片段从偏移量8开始,长度为2字节。
代码示例来源:origin: wildfly/wildfly
public static List<Range> computeFragOffsets(byte[] buf,int frag_size) {
return computeFragOffsets(0,buf.length,frag_size);
}
代码示例来源:origin: wildfly/wildfly
try {
byte[] buffer=msg.getRawBuffer();
final List<Range> fragments=Util.computeFragOffsets(msg.getOffset(), msg.getLength(), frag_size);
int num_frags=fragments.size();
num_frags_sent.add(num_frags);
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
public static java.util.List computeFragOffsets(byte[] buf, int frag_size) {
return computeFragOffsets(0, buf.length, frag_size);
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
public static List<Range> computeFragOffsets(byte[] buf,int frag_size) {
return computeFragOffsets(0,buf.length,frag_size);
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
fragments=Util.computeFragOffsets(buffer, frag_size);
num_frags=fragments.size();
num_sent_frags.addAndGet(num_frags);
代码示例来源:origin: org.jboss.eap/wildfly-client-all
try {
byte[] buffer=msg.getRawBuffer();
final List<Range> fragments=Util.computeFragOffsets(msg.getOffset(), msg.getLength(), frag_size);
int num_frags=fragments.size();
num_frags_sent.add(num_frags);
内容来源于网络,如有侵权,请联系作者删除!