当前位置: 首页>>代码示例>>Java>>正文


Java BufferReaderWriter.skipString0方法代码示例

本文整理汇总了Java中io.github.htools.io.buffer.BufferReaderWriter.skipString0方法的典型用法代码示例。如果您正苦于以下问题:Java BufferReaderWriter.skipString0方法的具体用法?Java BufferReaderWriter.skipString0怎么用?Java BufferReaderWriter.skipString0使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.github.htools.io.buffer.BufferReaderWriter的用法示例。


在下文中一共展示了BufferReaderWriter.skipString0方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: find

import io.github.htools.io.buffer.BufferReaderWriter; //导入方法依赖的package包/类
@Override
public StructuredFileCollisionRecord find(BufferReaderWriter table, StructuredFileCollisionRecord r) {
    Record rr = (Record) r;
    byte needle[] = rr.name.getBytes();
    int match;
    int offset = table.bufferpos;
    //log.info("find() %s offset %d end %d", rr.name, offset, table.end);
    while (table.bufferpos < table.end) {
        try {
            for (match = 0; match < needle.length && table.buffer[table.bufferpos + match] == needle[match]; match++);
            //log.info("match %d", match);
            if (match == needle.length && table.buffer[table.bufferpos + match] == 0) {
                table.skipString0();
                rr.count = table.readInt();
                return rr;
            }
            int bucketindex = ByteTools.string0HashCode(table.buffer, table.bufferpos, table.end) & (this.getBucketCapacity() - 1);
            if (bucketindex > rr.getBucketIndex()) {
                break;
            }
            String s = table.readString0();
            //log.info("%s %s", rr.name, s);
            table.skip(4);
        } catch (EOCException ex) {
            log.exception(ex, "find( %s, %s )", table, r);
        }
    }
    return null;
}
 
开发者ID:htools,项目名称:htools,代码行数:30,代码来源:StructuredFileCollisionTest.java

示例2: find

import io.github.htools.io.buffer.BufferReaderWriter; //导入方法依赖的package包/类
/**
 * this function is called by the internal {@link #find(Content.StructuredFileCollision.SortableCollisionRecord)
 * }
 * method, which seeks the offset at which the bucketIndex is position.
 * Because this is a collision table, if a matching entry exists, it is
 * always placed after this offset, as close to the offset as allowed, but
 * there can be other entries in between. An implementing function should
 * therefore readValue until the entry is found or a hashcode is
 * encountered that is greater than the search key's hashcode. In the
 * latter case, the entry does not exist and null should be returned.
 * <p/>
 * @param table the resident table to search, with the offset pointing to
 * the
 * @param r the entry containing the term string to search for
 * @return a matching entry, with its id, or null if it doesn't exist.
 */
@Override
public StructuredFileCollisionRecord find(BufferReaderWriter table, StructuredFileCollisionRecord r) {
   Record rr = (Record) r;
   byte needle[] = rr.term.getBytes();
   int match;
   int offset = table.bufferpos;
   while (table.bufferpos < table.end) {
      try {
         for (match = 0; match < needle.length && table.buffer[table.bufferpos + match] == needle[match]; match++);
         if (match == needle.length && table.buffer[table.bufferpos + match] == 0) {
            table.skipString0();
            rr.id = table.readInt();
            return rr;
         }
         int bucketindex = ByteTools.string0HashCode(table.buffer, table.bufferpos, table.end) & (this.getBucketCapacity() - 1);
         if (bucketindex > rr.getBucketIndex()) {
            break;
         }
         table.skipString0();
         table.skip(4);
      } catch (EOCException ex) {
         log.exception(ex, "find( %s, %s )", table, r);
      }
   }
   return null;
}
 
开发者ID:repir,项目名称:repir,代码行数:43,代码来源:VocMem4.java

示例3: find

import io.github.htools.io.buffer.BufferReaderWriter; //导入方法依赖的package包/类
/**
 * this function is called by the internal {@link #find(Content.StructuredFileCollision.SortableCollisionRecord)
 * }
 * method, which seeks the offset at which the bucketIndex is position.
 * Because this is a collision table, if a matching entry exists, it is
 * always placed after this offset, as close to the offset as allowed, but
 * there can be other entries in between. An implementing function should
 * therefore readValue until the entry is found or a hashcode is
 * encountered that is greater than the search key's hashcode. In the
 * latter case, the entry does not exist and null should be returned.
 * <p/>
 * @param table the resident table to search, with the offset pointing to
 * the
 * @param r the entry containing the term string to search for
 * @return a matching entry, with its id, or null if it doesn't exist.
 */
@Override
public StructuredFileCollisionRecord find(BufferReaderWriter table, StructuredFileCollisionRecord r) {
   Record rr = (Record) r;
   byte needle[] = rr.term.getBytes();
   int match;
   int offset = table.bufferpos;
   while (table.bufferpos < table.end) {
      try {
         for (match = 0; match < needle.length && table.buffer[table.bufferpos + match] == needle[match]; match++);
         if (match == needle.length && table.buffer[table.bufferpos + match] == 0) {
            table.skipString0();
            rr.id = table.readInt3();
            return rr;
         }
         int bucketindex = ByteTools.string0HashCode(table.buffer, table.bufferpos, table.end) & (this.getBucketCapacity() - 1);
         if (bucketindex > rr.getBucketIndex()) {
            break;
         }
         table.skipString0();
         table.skip(3);
      } catch (EOCException ex) {
         log.exception(ex, "find( %s, %s )", table, r);
      }
   }
   return null;
}
 
开发者ID:repir,项目名称:repir,代码行数:43,代码来源:VocMem3.java


注:本文中的io.github.htools.io.buffer.BufferReaderWriter.skipString0方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。