Package org.apache.hadoop.fs

Examples of org.apache.hadoop.fs.FSDataInputStream.available()


    available = in.available();
    TestCase.assertEquals((int) BLOCK_SIZE / 2, available);
    for(; i < len1 + len2 + len3; i++) {
      TestCase.assertEquals(i +" th number is wrong..", (byte)i, (byte)in.read())
    }
    available = in.available();
    TestCase.assertEquals(0, available);

    final int len4 = (int)BLOCK_SIZE / 4 - 7;
    AppendTestUtil.write(out, len1 + len2 + len3, len4);
    out.sync();
View Full Code Here


    TestCase.assertEquals(0, available);

    final int len4 = (int)BLOCK_SIZE / 4 - 7;
    AppendTestUtil.write(out, len1 + len2 + len3, len4);
    out.sync();
    available = in.available();
    for(; i < len1 + len2 + len3 + len4; i++) {
      TestCase.assertEquals(i +" th number is wrong..", (byte)i, (byte)in.read())
    }
   
    final int len5 = 2;
View Full Code Here

    AppendTestUtil.write(out, len1 + len2 + len3 + len4, len5);
    TestCase.assertTrue(in.isUnderConstruction());

    out.sync();

    available = in.available();
    TestCase.assertEquals(len5, available);
    for(; i < len1 + len2 + len3 + len4 + len5; i++) {
      TestCase.assertEquals(i +" th number is wrong..", (byte)i, (byte)in.read())
    }
    available = in.available();
View Full Code Here

    available = in.available();
    TestCase.assertEquals(len5, available);
    for(; i < len1 + len2 + len3 + len4 + len5; i++) {
      TestCase.assertEquals(i +" th number is wrong..", (byte)i, (byte)in.read())
    }
    available = in.available();
    TestCase.assertEquals(0, available);

    out.close();

    available = in.available();
View Full Code Here

    available = in.available();
    TestCase.assertEquals(0, available);

    out.close();

    available = in.available();
    TestCase.assertEquals(0, available);
    TestCase.assertFalse(in.isUnderConstruction());
   
    in.close();
View Full Code Here

        v = s2.read();
        assertEquals(v, 32);
        v = s2.read();
        assertEquals(v, 32);

        assertEquals(s2.available(), data.length);

        byte[] buf = new byte[bufsz];
        s2.read(buf, 0, buf.length);
        nread = s2.getPos();
View Full Code Here

        nread = s2.getPos();

        for (int i = 0; i < data.length; i++)
            assertEquals(data[i], buf[i]);

        assertEquals(s2.available(), 0);

        s2.close();

        // append some data to the file
        try {
View Full Code Here

    return f.getAbsolutePath();
  }

  private String readFully(Path file) throws IOException {
    FSDataInputStream in = fs.open(file);
    byte[] b = new byte[in.available()];
    in.readFully(b);
    in.close();
    return new String(b);
  }
View Full Code Here

    FSDataInputStream is = null;
    try {
      is = fs.open(path);
      /* file is empty, use TXT readerup */
      if (0 == is.available()) {
        return HdfsFileType.TXT;
      }

      switch (is.readShort()) {
      case 0x5345:
View Full Code Here

        return f.getAbsolutePath();
    }

    private String readFully(Path file) throws IOException {
        FSDataInputStream in = fs.open(file);
        byte[] b = new byte[in.available()];
        in.readFully(b);
        in.close();
        return new String(b);
    }
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.