Examples of Reader


Examples of org.apache.hadoop.io.SequenceFile.Reader

      }
      if (dump) {
        if (!fs.isFile(logPath)) {
          throw new IOException(args[i] + " is not a file");
        }
        Reader log = new SequenceFile.Reader(fs, logPath, conf);
        try {
          HLogKey key = new HLogKey();
          KeyValue val = new KeyValue();
          while (log.next(key, val)) {
            System.out.println(key.toString() + " " + val.toString());
          }
        } finally {
          log.close();
        }
      } else {
        if (!fs.getFileStatus(logPath).isDir()) {
          throw new IOException(args[i] + " is not a directory");
        }
View Full Code Here

Examples of org.apache.hadoop.io.file.tfile.TFile.Reader

    fs.delete(path, true);
  }

  // we still can scan records in an unsorted TFile
  public void testFailureScannerWithKeys() throws IOException {
    Reader reader =
        new Reader(fs.open(path), fs.getFileStatus(path).getLen(), conf);
    Assert.assertFalse(reader.isSorted());
    Assert.assertEquals((int) reader.getEntryCount(), 4);

    try {
      Scanner scanner =
          reader.createScannerByKey("aaa".getBytes(), "zzz".getBytes());
      Assert
          .fail("Failed to catch creating scanner with keys on unsorted file.");
    }
    catch (RuntimeException e) {
    }
    finally {
      reader.close();
    }
  }
View Full Code Here

Examples of org.apache.hadoop.zebra.tfile.TFile.Reader

  void readFile() throws IOException {
    long fileLength = fs.getFileStatus(path).getLen();
    int numSplit = 10;
    long splitSize = fileLength / numSplit + 1;

    Reader reader =
        new Reader(fs.open(path), fs.getFileStatus(path).getLen(), conf);
    long offset = 0;
    long rowCount = 0;
    BytesWritable key, value;
    for (int i = 0; i < numSplit; ++i, offset += splitSize) {
      Scanner scanner = reader.createScannerByByteRange(offset, splitSize);
      int count = 0;
      key = new BytesWritable();
      value = new BytesWritable();
      while (!scanner.atEnd()) {
        scanner.entry().get(key, value);
        ++count;
        scanner.advance();
      }
      scanner.close();
      Assert.assertTrue(count > 0);
      rowCount += count;
    }
    Assert.assertEquals(rowCount, reader.getEntryCount());
    reader.close();
  }
View Full Code Here

Examples of org.apache.lucene.util.packed.PackedInts.Reader

      w.finish();
      final long end = out.getFilePointer();
      out.close();

      IndexInput in = dir.openInput("out", newIOContext(random()));
      Reader reader = PackedInts.getReader(in);
      String msg = "Impl=" + w.getClass().getSimpleName() + ", bitsPerValue=" + bitsPerValue;
      assertEquals(msg, 1, reader.size());
      assertEquals(msg, value, reader.get(0));
      assertEquals(msg, end, in.getFilePointer());
      in.close();

      dir.close();
    }
View Full Code Here

Examples of org.apache.tez.runtime.api.Reader

    public void run() throws Exception {
      Preconditions.checkState(getInputs().size() == 2);
      Preconditions.checkState(getOutputs().size() == 0);
      LogicalInput lhsInput = getInputs().get(LHS_INPUT_NAME);
      LogicalInput rhsInput = getInputs().get(RHS_INPUT_NAME);
      Reader lhsReaderRaw = lhsInput.getReader();
      Reader rhsReaderRaw = rhsInput.getReader();
      Preconditions.checkState(lhsReaderRaw instanceof KeyValuesReader);
      Preconditions.checkState(rhsReaderRaw instanceof KeyValuesReader);
      KeyValuesReader lhsReader = (KeyValuesReader) lhsReaderRaw;
      KeyValuesReader rhsReader = (KeyValuesReader) rhsReaderRaw;
View Full Code Here

Examples of org.apache.tez.runtime.library.common.sort.impl.IFile.Reader

    writer.append(key, value);
    writer.append(key, value);
    writer.append(key, value);
    writer.close();

    IFile.Reader reader = new Reader(localFs, outputPath, null, null, null, false, -1, 1024);
    DataInputBuffer keyIn = new DataInputBuffer();
    DataInputBuffer valIn = new DataInputBuffer();
    int records = 0;
    while (reader.nextRawKey(keyIn)) {
      reader.nextRawValue(valIn);
      records++;
      assert(keyIn.getLength() == 0);
      assert(valIn.getLength() == 0);
    }
    assertTrue("Number of records read does not match", (records == 4));
    reader.close();
  }
View Full Code Here

Examples of org.eclipse.emf.mwe.utils.Reader

        propertiesOutlet.setPath(config.getGenPathCodeSnippet());

        /*
         * Create Reader
         */
        Reader reader = new Reader();
        // String "file:" is required for external files in Eclipse Plugins
        reader.setUri("file:/" + config.getEcorePath());
        reader.setModelSlot("model");

        /*
         * Directory Cleaner
         */
        DirectoryCleaner cleaner = new DirectoryCleaner();
        cleaner.setDirectory(config.getGenPath());
        cleaner.addExclude("Database.java");
        cleaner.addExclude("gen.properties");

        /*
         * Create Database Generator
         */
        Generator databaseGen = new Generator();
        databaseGen.setExpand(EXPAND_DATABASE);
        databaseGen.setFileEncoding(config.getFileEncoding());
        databaseGen.addMetaModel(emfMetaModel);
        databaseGen.addOutlet(javaOutlet);
        databaseGen.setPrDefaultExcludes(true);
        databaseGen.setPrSrcPaths(config.getGenPath());

        /*
         * Create Content Provider Generator
         */
        Generator contentProviderGen = new Generator();
        contentProviderGen.setExpand(EXPAND_CONTENT_PROVIDER);
        contentProviderGen.setFileEncoding(config.getFileEncoding());
        contentProviderGen.addMetaModel(emfMetaModel);
        contentProviderGen.addOutlet(javaOutlet);

        /*
         * Create Model Generator
         */
        Generator modelGen = new Generator();
        modelGen.setExpand(EXPAND_MODEL);
        modelGen.setFileEncoding(config.getFileEncoding());
        modelGen.addMetaModel(emfMetaModel);
        modelGen.addOutlet(javaOutlet);

        /*
         * Create Code Snippet Generator
         */
        Generator snippetGen = new Generator();
        snippetGen.setExpand(EXPAND_CODE_SNIPPET);
        snippetGen.setFileEncoding(config.getFileEncoding());
        snippetGen.addMetaModel(emfMetaModel);
        snippetGen.addOutlet(propertiesOutlet);

        /*
         * Execute Reader and Generators
         */
        reader.invoke(ctx, monitor, issues);
        cleaner.invoke(ctx, monitor, issues);
        databaseGen.invoke(ctx, monitor, issues);
        contentProviderGen.invoke(ctx, monitor, issues);
        modelGen.invoke(ctx, monitor, issues);
        snippetGen.invoke(ctx, monitor, issues);
View Full Code Here

Examples of org.fnlp.data.reader.Reader

    //建立pipe组合
    SeriesPipes pp = new SeriesPipes(new Pipe[]{removepp,segpp,s2spp,targetpp,sparsepp});

    System.out.print("\nReading data......\n");
    InstanceSet instset = new InstanceSet(pp,af)
    Reader reader = new MyDocumentReader(trainDataPath,"gbk");
    instset.loadThruStagePipes(reader);
    System.out.print("..Reading data complete\n");
   
    //将数据集分为训练是和测试集
    System.out.print("Sspliting....");
View Full Code Here

Examples of org.g4studio.common.dao.Reader

   *
   * @param jsbh
   * @return Dto
   */
  public Dto queryBalanceInfo(String jsbh) {
    Reader reader = (Reader) SpringBeanLoader.getSpringBean("g4Reader");
    Dto inDto = new BaseDto("sxh", jsbh);
    Dto outDto = (BaseDto)reader.queryForObject("Demo.queryBalanceInfo", inDto);
    return outDto;
  }
View Full Code Here

Examples of org.glassfish.grizzly.Reader

        @Override
        protected void onOpenInputSource() throws IOException {
            final Connection connection = parentStreamReader.getConnection();
            final Transport transport = connection.getTransport();
            final Reader reader = transport.getReader(connection);

            interceptor = new InputInterceptor();
            reader.read(connection, null, null, interceptor);
        }
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.