• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java InputStreamDataInput类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.lucene.store.InputStreamDataInput的典型用法代码示例。如果您正苦于以下问题:Java InputStreamDataInput类的具体用法?Java InputStreamDataInput怎么用?Java InputStreamDataInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



InputStreamDataInput类属于org.apache.lucene.store包,在下文中一共展示了InputStreamDataInput类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: read

import org.apache.lucene.store.InputStreamDataInput; //导入依赖的package包/类
/**
 * Reads an automaton from a file. 
 */
public static <T> FST<T> read(File file, Outputs<T> outputs) throws IOException {
  InputStream is = new BufferedInputStream(new FileInputStream(file));
  boolean success = false;
  try {
    FST<T> fst = new FST<>(new InputStreamDataInput(is), outputs);
    success = true;
    return fst;
  } finally {
    if (success) { 
      IOUtils.close(is);
    } else {
      IOUtils.closeWhileHandlingException(is); 
    }
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:FST.java


示例2: readFrom

import org.apache.lucene.store.InputStreamDataInput; //导入依赖的package包/类
@Override
public void readFrom(InputStream in) throws IOException {
	DataInput input = new InputStreamDataInput(in);

	map = new CharVectorHashMap<CharVector[]>(ignoreCase);

	int size = input.readVInt();
	for (int entryInx = 0; entryInx < size; entryInx++) {
		CharVector key = new CharVector(input.readUString());

		int valueLength = input.readVInt();

		CharVector[] values = new CharVector[valueLength];

		for (int valueInx = 0; valueInx < valueLength; valueInx++) {
			values[valueInx] = new CharVector(input.readUString());
		}
		map.put(key, values);
	}

}
 
开发者ID:gncloud,项目名称:fastcatsearch3,代码行数:22,代码来源:MapDictionary.java


示例3: test

import org.apache.lucene.store.InputStreamDataInput; //导入依赖的package包/类
@Test
public void test() throws IOException {
	String str = "abcdefghijk1234567한글입니다.1111日本語 ( にほんご";
	System.out.println(str);
	ByteArrayOutputStream baos = new ByteArrayOutputStream();
	DataOutput output = new OutputStreamDataOutput(baos);
	output.writeString(str);
	output.flush();
	
	byte[] buffer = baos.toByteArray();
	
	ByteArrayInputStream bais = new ByteArrayInputStream(buffer);
	DataInput input = new InputStreamDataInput(bais);
	String actual = input.readString();
	
	System.out.println(actual);
	assertTrue(actual.equals(str));
}
 
开发者ID:gncloud,项目名称:fastcatsearch3,代码行数:19,代码来源:DataIOTest.java


示例4: TokenInfoDictionary

import org.apache.lucene.store.InputStreamDataInput; //导入依赖的package包/类
private TokenInfoDictionary() throws IOException {
  super();
  InputStream is = null;
  FST<Long> fst = null;
  boolean success = false;
  try {
    is = getResource(FST_FILENAME_SUFFIX);
    is = new BufferedInputStream(is);
    fst = new FST<>(new InputStreamDataInput(is), PositiveIntOutputs.getSingleton());
    success = true;
  } finally {
    if (success) {
      IOUtils.close(is);
    } else {
      IOUtils.closeWhileHandlingException(is);
    }
  }
  // TODO: some way to configure?
  this.fst = new TokenInfoFST(fst, true);
}
 
开发者ID:europeana,项目名称:search,代码行数:21,代码来源:TokenInfoDictionary.java


示例5: CharacterDefinition

import org.apache.lucene.store.InputStreamDataInput; //导入依赖的package包/类
private CharacterDefinition() throws IOException {
  InputStream is = null;
  boolean success = false;
  try {
    is = BinaryDictionary.getClassResource(getClass(), FILENAME_SUFFIX);
    is = new BufferedInputStream(is);
    final DataInput in = new InputStreamDataInput(is);
    CodecUtil.checkHeader(in, HEADER, VERSION, VERSION);
    in.readBytes(characterCategoryMap, 0, characterCategoryMap.length);
    for (int i = 0; i < CLASS_COUNT; i++) {
      final byte b = in.readByte();
      invokeMap[i] = (b & 0x01) != 0;
      groupMap[i] = (b & 0x02) != 0;
    }
    success = true;
  } finally {
    if (success) {
      IOUtils.close(is);
    } else {
      IOUtils.closeWhileHandlingException(is);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:24,代码来源:CharacterDefinition.java


示例6: TokenInfoDictionary

import org.apache.lucene.store.InputStreamDataInput; //导入依赖的package包/类
private TokenInfoDictionary() throws IOException {
  super();
  IOException priorE = null;
  InputStream is = null;
  FST<Long> fst = null;
  try {
    is = getResource(FST_FILENAME_SUFFIX);
    is = new BufferedInputStream(is);
    fst = new FST<Long>(new InputStreamDataInput(is), PositiveIntOutputs.getSingleton(true));
  } catch (IOException ioe) {
    priorE = ioe;
  } finally {
    IOUtils.closeWhileHandlingException(priorE, is);
  }
  // TODO: some way to configure?
  this.fst = new TokenInfoFST(fst, true);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:18,代码来源:TokenInfoDictionary.java


示例7: CharacterDefinition

import org.apache.lucene.store.InputStreamDataInput; //导入依赖的package包/类
private CharacterDefinition() throws IOException {
  IOException priorE = null;
  InputStream is = null;
  try {
    is = BinaryDictionary.getClassResource(getClass(), FILENAME_SUFFIX);
    is = new BufferedInputStream(is);
    final DataInput in = new InputStreamDataInput(is);
    CodecUtil.checkHeader(in, HEADER, VERSION, VERSION);
    in.readBytes(characterCategoryMap, 0, characterCategoryMap.length);
    for (int i = 0; i < CLASS_COUNT; i++) {
      final byte b = in.readByte();
      invokeMap[i] = (b & 0x01) != 0;
      groupMap[i] = (b & 0x02) != 0;
    }
  } catch (IOException ioe) {
    priorE = ioe;
  } finally {
    IOUtils.closeWhileHandlingException(priorE, is);
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:21,代码来源:CharacterDefinition.java


示例8: read

import org.apache.lucene.store.InputStreamDataInput; //导入依赖的package包/类
/**
 * Reads an automaton from a file. 
 */
public static <T> FST<T> read(File file, Outputs<T> outputs) throws IOException {
  InputStream is = new BufferedInputStream(new FileInputStream(file));
  boolean success = false;
  try {
    FST<T> fst = new FST<T>(new InputStreamDataInput(is), outputs);
    success = true;
    return fst;
  } finally {
    if (success) { 
      IOUtils.close(is);
    } else {
      IOUtils.closeWhileHandlingException(is); 
    }
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:19,代码来源:FST.java


示例9: TokenInfoDictionary

import org.apache.lucene.store.InputStreamDataInput; //导入依赖的package包/类
private TokenInfoDictionary() throws IOException {
  super();
  IOException priorE = null;
  InputStream is = null;
  FST<Long> fst = null;
  try {
    is = getResource(FST_FILENAME_SUFFIX);
    is = new BufferedInputStream(is);
    fst = new FST<Long>(new InputStreamDataInput(is), PositiveIntOutputs.getSingleton());
  } catch (IOException ioe) {
    priorE = ioe;
  } finally {
    IOUtils.closeWhileHandlingException(priorE, is);
  }
  // TODO: some way to configure?
  this.fst = new TokenInfoFST(fst, true);
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:18,代码来源:TokenInfoDictionary.java


示例10: load

import org.apache.lucene.store.InputStreamDataInput; //导入依赖的package包/类
@Override
public boolean load(InputStream input) throws IOException {
  DataInput in = new InputStreamDataInput(input);
  CodecUtil.checkHeader(in, CODEC_NAME, VERSION_START, VERSION_START);
  byte separatorOrig = in.readByte();
  if (separatorOrig != separator) {
    throw new IllegalStateException("separator=" + separator + " is incorrect: original model was built with separator=" + separatorOrig);
  }
  int gramsOrig = in.readVInt();
  if (gramsOrig != grams) {
    throw new IllegalStateException("grams=" + grams + " is incorrect: original model was built with grams=" + gramsOrig);
  }
  totTokens = in.readVLong();

  fst = new FST<Long>(in, PositiveIntOutputs.getSingleton());

  return true;
}
 
开发者ID:jimaguere,项目名称:Maskana-Gestor-de-Conocimiento,代码行数:19,代码来源:FreeTextSuggester.java


示例11: load

import org.apache.lucene.store.InputStreamDataInput; //导入依赖的package包/类
@Override
public boolean load(InputStream input) throws IOException {
  DataInput dataIn = new InputStreamDataInput(input);
  try {
    this.fst = new FST<>(dataIn, new PairOutputs<>(
        PositiveIntOutputs.getSingleton(), ByteSequenceOutputs.getSingleton()));
    maxAnalyzedPathsForOneInput = dataIn.readVInt();
    hasPayloads = dataIn.readByte() == 1;
  } finally {
    IOUtils.close(input);
  }
  return true;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:XAnalyzingSuggester.java


示例12: load

import org.apache.lucene.store.InputStreamDataInput; //导入依赖的package包/类
@Override
public boolean load(InputStream input) throws IOException {
  DataInput dataIn = new InputStreamDataInput(input);
  try {
    this.fst = new FST<>(dataIn, new PairOutputs<>(PositiveIntOutputs.getSingleton(), ByteSequenceOutputs.getSingleton()));
    maxAnalyzedPathsForOneInput = dataIn.readVInt();
    hasPayloads = dataIn.readByte() == 1;
  } finally {
    IOUtils.close(input);
  }
  return true;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:13,代码来源:XAnalyzingSuggester.java


示例13: parsePayload

import org.apache.lucene.store.InputStreamDataInput; //导入依赖的package包/类
@Override
public void parsePayload(BytesRef payload, SuggestPayload ref) throws IOException {
    ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(payload.bytes, payload.offset, payload.length);
    InputStreamDataInput input = new InputStreamDataInput(byteArrayInputStream);
    ref.weight = input.readVLong() - 1;
    int len = input.readVInt();
    ref.surfaceForm.grow(len);
    ref.surfaceForm.setLength(len);
    input.readBytes(ref.surfaceForm.bytes(), 0, ref.surfaceForm.length());
    len = input.readVInt();
    ref.payload.grow(len);
    ref.payload.setLength(len);
    input.readBytes(ref.payload.bytes(), 0, ref.payload.length());
    input.close();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:16,代码来源:Completion090PostingsFormat.java


示例14: readFrom

import org.apache.lucene.store.InputStreamDataInput; //导入依赖的package包/类
@Override
public void readFrom(InputStream in) throws IOException {
	super.readFrom(in);
	DataInput input = new InputStreamDataInput(in);
	wordSet = new CharVectorHashSet(ignoreCase);
	int size = input.readVInt();
	for (int entryInx = 0; entryInx < size; entryInx++) {
		wordSet.add(new CharVector(input.readUString()));
	}
}
 
开发者ID:gncloud,项目名称:fastcatsearch3,代码行数:11,代码来源:SpaceDictionary.java


示例15: readFrom

import org.apache.lucene.store.InputStreamDataInput; //导入依赖的package包/类
@Override
public void readFrom(InputStream in) throws IOException {
	
	DataInput input = new InputStreamDataInput(in);
	set = new CharVectorHashSet(ignoreCase);
	int size = input.readInt();
	
	for(int entryInx=0;entryInx < size; entryInx++) {
		set.add(new CharVector(input.readString()));
	}
}
 
开发者ID:gncloud,项目名称:fastcatsearch3,代码行数:12,代码来源:SetDictionary.java


示例16: readFrom

import org.apache.lucene.store.InputStreamDataInput; //导入依赖的package包/类
@Override
public void readFrom(InputStream in) throws IOException {
	super.readFrom(in);
	DataInput input = new InputStreamDataInput(in);
	mainWordSet = new CharVectorHashSet(ignoreCase);
	int mainWordSize = input.readVInt();
	for (int entryInx = 0; entryInx < mainWordSize; entryInx++) {
		mainWordSet.add(new CharVector(input.readUString()));
	}
	wordSet = new CharVectorHashSet(ignoreCase);
	int size = input.readVInt();
	for (int entryInx = 0; entryInx < size; entryInx++) {
		wordSet.add(new CharVector(input.readUString()));
	}
}
 
开发者ID:gncloud,项目名称:fastcatsearch3,代码行数:16,代码来源:CompoundDictionary.java


示例17: readFrom

import org.apache.lucene.store.InputStreamDataInput; //导入依赖的package包/类
@Override
public void readFrom(InputStream in) throws IOException {
	DataInput input = new InputStreamDataInput(in);
	
	map = new HashMap<CharVector, Object[]>();
	int size = input.readVInt();
	for (int entryInx = 0; entryInx < size; entryInx++) {
		CharVector key = new CharVector(input.readUString());

		int valueLength = input.readVInt();

		Object[] values = new Object[valueLength];

		for (int valueInx = 0; valueInx < valueLength; valueInx++) {
			
			int type = input.readByte();
			if(type == 1 ) {
				values[valueInx] = new CharVector(input.readUString());	
			} else if(type == 2 ) {
				int len = input.readVInt();
				CharVector[] list = new CharVector[len];
				for (int j = 0; j < len; j++) {
					list[j] = new CharVector(input.readUString());
				}
			}
			
			
		}
		map.put(key, values);
	}
	
	wordSet = new CharVectorHashSet(ignoreCase);
	size = input.readVInt();
	for (int entryInx = 0; entryInx < size; entryInx++) {
		wordSet.add(new CharVector(input.readUString()));
	}
}
 
开发者ID:gncloud,项目名称:fastcatsearch3,代码行数:38,代码来源:CustomDictionary.java


示例18: load

import org.apache.lucene.store.InputStreamDataInput; //导入依赖的package包/类
/**
 * Calls {@link #load(DataInput)} after converting
 * {@link InputStream} to {@link DataInput}
 */
public boolean load(InputStream input) throws IOException {
  DataInput dataIn = new InputStreamDataInput(input);
  try {
    return load(dataIn);
  } finally {
    IOUtils.close(input);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:13,代码来源:Lookup.java


示例19: ConnectionCosts

import org.apache.lucene.store.InputStreamDataInput; //导入依赖的package包/类
private ConnectionCosts() throws IOException {
  InputStream is = null;
  short[][] costs = null;
  boolean success = false;
  try {
    is = BinaryDictionary.getClassResource(getClass(), FILENAME_SUFFIX);
    is = new BufferedInputStream(is);
    final DataInput in = new InputStreamDataInput(is);
    CodecUtil.checkHeader(in, HEADER, VERSION, VERSION);
    int forwardSize = in.readVInt();
    int backwardSize = in.readVInt();
    costs = new short[backwardSize][forwardSize];
    int accum = 0;
    for (int j = 0; j < costs.length; j++) {
      final short[] a = costs[j];
      for (int i = 0; i < a.length; i++) {
        accum += in.readZInt();
        a[i] = (short)accum;
      }
    }
    success = true;
  } finally {
    if (success) {
      IOUtils.close(is);
    } else {
      IOUtils.closeWhileHandlingException(is);
    }
  }
  
  this.costs = costs;
}
 
开发者ID:europeana,项目名称:search,代码行数:32,代码来源:ConnectionCosts.java


示例20: load

import org.apache.lucene.store.InputStreamDataInput; //导入依赖的package包/类
@Override
public boolean load(InputStream input) throws IOException {
  DataInput dataIn = new InputStreamDataInput(input);
  try {
    this.fst = new FST<Pair<Long,BytesRef>>(dataIn, new PairOutputs<Long,BytesRef>(PositiveIntOutputs.getSingleton(true), ByteSequenceOutputs.getSingleton()));
    maxAnalyzedPathsForOneInput = dataIn.readVInt();
  } finally {
    IOUtils.close(input);
  }
  return true;
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:12,代码来源:AnalyzingSuggester.java



注:本文中的org.apache.lucene.store.InputStreamDataInput类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Duration类代码示例发布时间:2022-05-22
下一篇:
Java Theme类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap