本文整理汇总了Java中org.apache.lucene.analysis.util.CharacterUtils.CharacterBuffer类的典型用法代码示例。如果您正苦于以下问题:Java CharacterBuffer类的具体用法?Java CharacterBuffer怎么用?Java CharacterBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CharacterBuffer类属于org.apache.lucene.analysis.util.CharacterUtils包,在下文中一共展示了CharacterBuffer类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testNewCharacterBuffer
import org.apache.lucene.analysis.util.CharacterUtils.CharacterBuffer; //导入依赖的package包/类
@Test
public void testNewCharacterBuffer() {
CharacterBuffer newCharacterBuffer = CharacterUtils.newCharacterBuffer(1024);
assertEquals(1024, newCharacterBuffer.getBuffer().length);
assertEquals(0, newCharacterBuffer.getOffset());
assertEquals(0, newCharacterBuffer.getLength());
newCharacterBuffer = CharacterUtils.newCharacterBuffer(2);
assertEquals(2, newCharacterBuffer.getBuffer().length);
assertEquals(0, newCharacterBuffer.getOffset());
assertEquals(0, newCharacterBuffer.getLength());
try {
newCharacterBuffer = CharacterUtils.newCharacterBuffer(1);
fail("length must be >= 2");
} catch (IllegalArgumentException e) {
}
}
开发者ID:europeana,项目名称:search,代码行数:19,代码来源:TestCharacterUtils.java
示例2: testFillNoHighSurrogate
import org.apache.lucene.analysis.util.CharacterUtils.CharacterBuffer; //导入依赖的package包/类
@Test
public void testFillNoHighSurrogate() throws IOException {
Version[] versions = new Version[] { Version.LUCENE_3_0, TEST_VERSION_CURRENT };
for (Version version : versions) {
CharacterUtils instance = CharacterUtils.getInstance(version);
Reader reader = new StringReader("helloworld");
CharacterBuffer buffer = CharacterUtils.newCharacterBuffer(6);
assertTrue(instance.fill(buffer,reader));
assertEquals(0, buffer.getOffset());
assertEquals(6, buffer.getLength());
assertEquals("hellow", new String(buffer.getBuffer()));
assertFalse(instance.fill(buffer,reader));
assertEquals(4, buffer.getLength());
assertEquals(0, buffer.getOffset());
assertEquals("orld", new String(buffer.getBuffer(), buffer.getOffset(),
buffer.getLength()));
assertFalse(instance.fill(buffer,reader));
}
}
开发者ID:europeana,项目名称:search,代码行数:21,代码来源:TestCharacterUtils.java
示例3: testFillJava15
import org.apache.lucene.analysis.util.CharacterUtils.CharacterBuffer; //导入依赖的package包/类
@Test
public void testFillJava15() throws IOException {
String input = "1234\ud801\udc1c789123\ud801\ud801\udc1c\ud801";
CharacterUtils instance = CharacterUtils.getInstance();
Reader reader = new StringReader(input);
CharacterBuffer buffer = CharacterUtils.newCharacterBuffer(5);
assertTrue(instance.fill(buffer, reader));
assertEquals(4, buffer.getLength());
assertEquals("1234", new String(buffer.getBuffer(), buffer.getOffset(),
buffer.getLength()));
assertTrue(instance.fill(buffer, reader));
assertEquals(5, buffer.getLength());
assertEquals("\ud801\udc1c789", new String(buffer.getBuffer()));
assertTrue(instance.fill(buffer, reader));
assertEquals(4, buffer.getLength());
assertEquals("123\ud801", new String(buffer.getBuffer(),
buffer.getOffset(), buffer.getLength()));
assertFalse(instance.fill(buffer, reader));
assertEquals(3, buffer.getLength());
assertEquals("\ud801\udc1c\ud801", new String(buffer.getBuffer(), buffer
.getOffset(), buffer.getLength()));
assertFalse(instance.fill(buffer, reader));
assertEquals(0, buffer.getLength());
}
开发者ID:europeana,项目名称:search,代码行数:25,代码来源:TestCharacterUtils.java
示例4: testFillJava14
import org.apache.lucene.analysis.util.CharacterUtils.CharacterBuffer; //导入依赖的package包/类
@Test
public void testFillJava14() throws IOException {
String input = "1234\ud801\udc1c789123\ud801\ud801\udc1c\ud801";
CharacterUtils instance = CharacterUtils.getInstance(Version.LUCENE_3_0);
Reader reader = new StringReader(input);
CharacterBuffer buffer = CharacterUtils.newCharacterBuffer(5);
assertTrue(instance.fill(buffer, reader));
assertEquals(5, buffer.getLength());
assertEquals("1234\ud801", new String(buffer.getBuffer(), buffer
.getOffset(), buffer.getLength()));
assertTrue(instance.fill(buffer, reader));
assertEquals(5, buffer.getLength());
assertEquals("\udc1c7891", new String(buffer.getBuffer()));
buffer = CharacterUtils.newCharacterBuffer(6);
assertTrue(instance.fill(buffer, reader));
assertEquals(6, buffer.getLength());
assertEquals("23\ud801\ud801\udc1c\ud801", new String(buffer.getBuffer(), buffer
.getOffset(), buffer.getLength()));
assertFalse(instance.fill(buffer, reader));
}
开发者ID:europeana,项目名称:search,代码行数:22,代码来源:TestCharacterUtils.java
示例5: testFillNoHighSurrogate
import org.apache.lucene.analysis.util.CharacterUtils.CharacterBuffer; //导入依赖的package包/类
@Test
public void testFillNoHighSurrogate() throws IOException {
Version[] versions = new Version[] { Version.LUCENE_30, TEST_VERSION_CURRENT };
for (Version version : versions) {
CharacterUtils instance = CharacterUtils.getInstance(version);
Reader reader = new StringReader("helloworld");
CharacterBuffer buffer = CharacterUtils.newCharacterBuffer(6);
assertTrue(instance.fill(buffer,reader));
assertEquals(0, buffer.getOffset());
assertEquals(6, buffer.getLength());
assertEquals("hellow", new String(buffer.getBuffer()));
assertTrue(instance.fill(buffer,reader));
assertEquals(4, buffer.getLength());
assertEquals(0, buffer.getOffset());
assertEquals("orld", new String(buffer.getBuffer(), buffer.getOffset(),
buffer.getLength()));
assertFalse(instance.fill(buffer,reader));
}
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:21,代码来源:TestCharacterUtils.java
示例6: testFillJava14
import org.apache.lucene.analysis.util.CharacterUtils.CharacterBuffer; //导入依赖的package包/类
@Test
public void testFillJava14() throws IOException {
String input = "1234\ud801\udc1c789123\ud801\ud801\udc1c\ud801";
CharacterUtils instance = CharacterUtils.getInstance(Version.LUCENE_30);
Reader reader = new StringReader(input);
CharacterBuffer buffer = CharacterUtils.newCharacterBuffer(5);
assertTrue(instance.fill(buffer, reader));
assertEquals(5, buffer.getLength());
assertEquals("1234\ud801", new String(buffer.getBuffer(), buffer
.getOffset(), buffer.getLength()));
assertTrue(instance.fill(buffer, reader));
assertEquals(5, buffer.getLength());
assertEquals("\udc1c7891", new String(buffer.getBuffer()));
buffer = CharacterUtils.newCharacterBuffer(6);
assertTrue(instance.fill(buffer, reader));
assertEquals(6, buffer.getLength());
assertEquals("23\ud801\ud801\udc1c\ud801", new String(buffer.getBuffer(), buffer
.getOffset(), buffer.getLength()));
assertFalse(instance.fill(buffer, reader));
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:22,代码来源:TestCharacterUtils.java
示例7: testFillNoHighSurrogate
import org.apache.lucene.analysis.util.CharacterUtils.CharacterBuffer; //导入依赖的package包/类
@Test
public void testFillNoHighSurrogate() throws IOException {
Version[] versions = new Version[] { Version.LUCENE_30, TEST_VERSION_CURRENT };
for (Version version : versions) {
CharacterUtils instance = CharacterUtils.getInstance(version);
Reader reader = new StringReader("helloworld");
CharacterBuffer buffer = CharacterUtils.newCharacterBuffer(6);
assertTrue(instance.fill(buffer,reader));
assertEquals(0, buffer.getOffset());
assertEquals(6, buffer.getLength());
assertEquals("hellow", new String(buffer.getBuffer()));
assertFalse(instance.fill(buffer,reader));
assertEquals(4, buffer.getLength());
assertEquals(0, buffer.getOffset());
assertEquals("orld", new String(buffer.getBuffer(), buffer.getOffset(),
buffer.getLength()));
assertFalse(instance.fill(buffer,reader));
}
}
开发者ID:jimaguere,项目名称:Maskana-Gestor-de-Conocimiento,代码行数:21,代码来源:TestCharacterUtils.java
示例8: testFillJava15
import org.apache.lucene.analysis.util.CharacterUtils.CharacterBuffer; //导入依赖的package包/类
@Test
public void testFillJava15() throws IOException {
String input = "1234\ud801\udc1c789123\ud801\ud801\udc1c\ud801";
CharacterUtils instance = CharacterUtils.getInstance(TEST_VERSION_CURRENT);
Reader reader = new StringReader(input);
CharacterBuffer buffer = CharacterUtils.newCharacterBuffer(5);
assertTrue(instance.fill(buffer, reader));
assertEquals(4, buffer.getLength());
assertEquals("1234", new String(buffer.getBuffer(), buffer.getOffset(),
buffer.getLength()));
assertTrue(instance.fill(buffer, reader));
assertEquals(5, buffer.getLength());
assertEquals("\ud801\udc1c789", new String(buffer.getBuffer()));
assertTrue(instance.fill(buffer, reader));
assertEquals(4, buffer.getLength());
assertEquals("123\ud801", new String(buffer.getBuffer(),
buffer.getOffset(), buffer.getLength()));
assertFalse(instance.fill(buffer, reader));
assertEquals(3, buffer.getLength());
assertEquals("\ud801\udc1c\ud801", new String(buffer.getBuffer(), buffer
.getOffset(), buffer.getLength()));
assertFalse(instance.fill(buffer, reader));
assertEquals(0, buffer.getLength());
}
开发者ID:jimaguere,项目名称:Maskana-Gestor-de-Conocimiento,代码行数:25,代码来源:TestCharacterUtils.java
示例9: testFillJava15
import org.apache.lucene.analysis.util.CharacterUtils.CharacterBuffer; //导入依赖的package包/类
@Test
public void testFillJava15() throws IOException {
String input = "1234\ud801\udc1c789123\ud801\ud801\udc1c\ud801";
CharacterUtils instance = CharacterUtils.getInstance(TEST_VERSION_CURRENT);
Reader reader = new StringReader(input);
CharacterBuffer buffer = CharacterUtils.newCharacterBuffer(5);
assertTrue(instance.fill(buffer, reader));
assertEquals(4, buffer.getLength());
assertEquals("1234", new String(buffer.getBuffer(), buffer.getOffset(),
buffer.getLength()));
assertTrue(instance.fill(buffer, reader));
assertEquals(5, buffer.getLength());
assertEquals("\ud801\udc1c789", new String(buffer.getBuffer()));
assertTrue(instance.fill(buffer, reader));
assertEquals(4, buffer.getLength());
assertEquals("123\ud801", new String(buffer.getBuffer(),
buffer.getOffset(), buffer.getLength()));
assertTrue(instance.fill(buffer, reader));
assertEquals(2, buffer.getLength());
assertEquals("\ud801\udc1c", new String(buffer.getBuffer(), buffer
.getOffset(), buffer.getLength()));
assertTrue(instance.fill(buffer, reader));
assertEquals(1, buffer.getLength());
assertEquals("\ud801", new String(buffer.getBuffer(), buffer
.getOffset(), buffer.getLength()));
assertFalse(instance.fill(buffer, reader));
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:28,代码来源:TestCharacterUtils.java
注:本文中的org.apache.lucene.analysis.util.CharacterUtils.CharacterBuffer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论