Examples of InputStreamDataInput


Examples of org.apache.lucene.store.InputStreamDataInput

    InputStream is = null;
    short[][] costs = null;
    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++) {
          int raw = in.readVInt();
          accum += (raw >>> 1) ^ -(raw & 1);
          a[i] = (short)accum;
        }
      }
    } catch (IOException ioe) {
View Full Code Here

Examples of org.apache.lucene.store.InputStreamDataInput

   */
  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);
View Full Code Here

Examples of org.apache.lucene.store.InputStreamDataInput

  @Override
  public boolean load(InputStream input) throws IOException {
    InputStream is = new BufferedInputStream(input);
    try {
      this.automaton = new FST<Object>(new InputStreamDataInput(is), NoOutputs.getSingleton());
      cacheRootArcs();
    } finally {
      IOUtils.close(is);
    }
    return true;
View Full Code Here

Examples of org.apache.lucene.store.InputStreamDataInput

  @Override
  public synchronized boolean load(InputStream input) throws IOException {
    try {
      this.higherWeightsCompletion = new FSTCompletion(new FST<Object>(
          new InputStreamDataInput(input), NoOutputs.getSingleton()));
      this.normalCompletion = new FSTCompletion(
          higherWeightsCompletion.getFST(), false, exactMatchFirst);
    } finally {
      IOUtils.close(input);
    }
View Full Code Here

Examples of org.apache.lucene.store.InputStreamDataInput

      return false;
    }

    InputStream is = new BufferedInputStream(new FileInputStream(data));
    try {
      this.automaton = new FST<Object>(new InputStreamDataInput(is), NoOutputs.getSingleton());
      cacheRootArcs();
    } finally {
      IOUtils.close(is);
    }
    return true;
View Full Code Here

Examples of org.apache.lucene.store.InputStreamDataInput

    public StreamInput openInput(File translogFile) throws IOException {
        final FileInputStream fileInputStream = new FileInputStream(translogFile);
        boolean success = false;
        try {
            final InputStreamStreamInput in = new InputStreamStreamInput(fileInputStream);
            CodecUtil.checkHeader(new InputStreamDataInput(in), TranslogStreams.TRANSLOG_CODEC, VERSION, VERSION);
            success = true;
            return in;
        } catch (EOFException e) {
            throw new TruncatedTranslogException("translog header truncated", e);
        } catch (IOException e) {
View Full Code Here

Examples of org.apache.lucene.store.InputStreamDataInput

                if (header != CodecUtil.CODEC_MAGIC) {
                    throw new TranslogCorruptedException("translog looks like version 1 or later, but has corrupted header");
                }
                // Confirm the rest of the header using CodecUtil, extracting
                // the translog version
                int version = CodecUtil.checkHeaderNoMagic(new InputStreamDataInput(headerStream), TRANSLOG_CODEC, 1, Integer.MAX_VALUE);
                switch (version) {
                    case ChecksummedTranslogStream.VERSION:
                        return CHECKSUMMED_TRANSLOG_STREAM;
                    default:
                        throw new TranslogCorruptedException("No known translog stream version: " + version);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.