Package java.io

Examples of java.io.DataInput


   two.write(out);
  
   byte[] b = bout.toByteArray();
  
   ByteArrayInputStream bin = new ByteArrayInputStream(b);
   DataInput din = new DataInputStream(bin);
  
   one.readFields(din);

   assertEquals("foobar", one.getString());
   assertEquals(3, one.getFrequency());
View Full Code Here


    assertEquals(split, readSplit());
  }
 
  private InMemInputSplit readSplit() throws IOException {
    ByteArrayInputStream byteInStream = new ByteArrayInputStream(byteOutStream.toByteArray());
    DataInput in = new DataInputStream(byteInStream);
    return InMemInputSplit.read(in);
  }
View Full Code Here

    assertEquals(root, readNode());
  }

  Node readNode() throws IOException {
    ByteArrayInputStream byteInStream = new ByteArrayInputStream(byteOutStream.toByteArray());
    DataInput in = new DataInputStream(byteInStream);
    return Node.read(in);
  }
View Full Code Here

   */
  public String getProcessOutput() throws Exception {     
    process = Runtime.getRuntime().exec(command,getEnvironment());
    String result="";
    // read stderr and stdout streams
    DataInput stderr = new DataInputStream(process.getErrorStream());
    result += readStream(stderr);
    DataInput stdout  = new DataInputStream(process.getInputStream());
    result += readStream(stdout);
    return result;
  }
View Full Code Here

    } catch (Exception e) {
      System.out.println ("Unable to retrieve the midkey");
    }

    // Printing general bloom information
    DataInput bloomMeta = reader.getGeneralBloomFilterMetadata();
    BloomFilter bloomFilter = null;
    if (bloomMeta != null)
      bloomFilter = BloomFilterFactory.createFromMeta(bloomMeta, reader);

    System.out.println("Bloom filter:");
View Full Code Here

      try {
        if (blockType == BlockType.GENERAL_BLOOM_META) {
          if (this.generalBloomFilter != null)
            return; // Bloom has been loaded

          DataInput bloomMeta = reader.getGeneralBloomFilterMetadata();
          if (bloomMeta != null) {
            // sanity check for NONE Bloom filter
            if (bloomFilterType == BloomType.NONE) {
              throw new IOException(
                  "valid bloom filter type not found in FileInfo");
            } else {
              generalBloomFilter = BloomFilterFactory.createFromMeta(bloomMeta,
                  reader);
              if (LOG.isTraceEnabled()) {
                LOG.trace("Loaded " + bloomFilterType.toString() + " "
                  + generalBloomFilter.getClass().getSimpleName()
                  + " metadata for " + reader.getName());
              }
            }
          }
        } else if (blockType == BlockType.DELETE_FAMILY_BLOOM_META) {
          if (this.deleteFamilyBloomFilter != null)
            return; // Bloom has been loaded

          DataInput bloomMeta = reader.getDeleteBloomFilterMetadata();
          if (bloomMeta != null) {
            deleteFamilyBloomFilter = BloomFilterFactory.createFromMeta(
                bloomMeta, reader);
            LOG.info("Loaded Delete Family Bloom ("
                + deleteFamilyBloomFilter.getClass().getSimpleName()
View Full Code Here

        }
        fileOutStream.flush();
        fileOutStream.close();

        InputStream fInStream = new FileInputStream(f);
        DataInput inpStream = new DataInputStream(fInStream);

        for (int i = 0; i < recs.length; i++) {
            HCatRecord rec = new DefaultHCatRecord();
            rec.readFields(inpStream);
            Assert.assertTrue(HCatDataCheckUtil.recordsEqual(recs[i], rec));
View Full Code Here

    assertTrue("Check if data is serialized to output stream.", bout.size() > 0);

    byte[] bytes = bout.toByteArray();

    ByteArrayInputStream bin = new ByteArrayInputStream(bytes);
    DataInput in = new DataInputStream(bin);

    Directive r = new Directive();
    r.readFields(in);

    assertEquals("Check the reqeust type.", Directive.Type.Request.value(), r
View Full Code Here

    assertTrue("Check if output has data.", bout.size() > 0);

    byte[] bytes = bout.toByteArray();

    ByteArrayInputStream bin = new ByteArrayInputStream(bytes);
    DataInput in = new DataInputStream(bin);

    Directive r = new Directive();
    r.readFields(in);

    assertEquals("Check directive type is correct.", r.getType().value(), w
View Full Code Here

        throw new DeserializationException(e);
      }
    } else {
      ListMultimap<String,TablePermission> perms = ArrayListMultimap.create();
      try {
        DataInput in = new DataInputStream(new ByteArrayInputStream(data));
        int length = in.readInt();
        for (int i=0; i<length; i++) {
          String user = Text.readString(in);
          List<TablePermission> userPerms =
            (List)HbaseObjectWritableFor96Migration.readObject(in, conf);
          perms.putAll(user, userPerms);
View Full Code Here

TOP

Related Classes of java.io.DataInput

Copyright © 2018 www.massapicom. 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.