Package org.apache.hadoop.io

Examples of org.apache.hadoop.io.UTF8$TempArrays


    long totalSize = 0;
    long maxSize = ((megaBytes / numFiles) * 2) + 1;
    try {
      while (totalSize < megaBytes) {
        UTF8 name = new UTF8(Long.toString(random.nextLong()));

        long size = random.nextLong();
        if (size < 0)
          size = -size;
        size = size % maxSize;
View Full Code Here


        out.close();
      }
      // rename to final location
      fs.rename(tempFile, new Path(DATA_DIR, name));

      collector.collect(new UTF8("bytes"), new LongWritable(written));

      reporter.setStatus("wrote " + name);
    }
View Full Code Here

        }
      } finally {
        in.close();
      }

      collector.collect(new UTF8("bytes"), new LongWritable(read));

      reporter.setStatus("read " + name);
    }
View Full Code Here

        writableTypeToJson(new Text("some text"));
    }

    @Test
    public void testUTF8() {
        writableTypeToJson(new UTF8("some utf8"));
    }
View Full Code Here

    assertTrue(Arrays.equals(stringResults, new String[]{"foo","bar"}));

    stringResults = proxy.echo((String[])null);
    assertTrue(Arrays.equals(stringResults, null));

    UTF8 utf8Result = (UTF8)proxy.echo(new UTF8("hello world"));
    assertEquals(utf8Result, new UTF8("hello world"));

    utf8Result = (UTF8)proxy.echo((UTF8)null);
    assertEquals(utf8Result, null);

    int intResult = proxy.add(1, 2);
View Full Code Here

  // This should be reverted to package private once the ImageLoader
  // code is moved into this package. This method should not be called
  // by other code.
  @SuppressWarnings("deprecation")
  public static String readString(DataInputStream in) throws IOException {
    UTF8 ustr = TL_DATA.get().U_STR;
    ustr.readFields(in);
    return ustr.toString();
  }
View Full Code Here

    return s.isEmpty()? null: s;
  }

  @SuppressWarnings("deprecation")
  static void writeString(String str, DataOutputStream out) throws IOException {
    UTF8 ustr = TL_DATA.get().U_STR;
    ustr.set(str, true);
    ustr.write(out);
  }
View Full Code Here

    uLong.write(out);
  }
 
  /** read the long value */
  static long readLongAsString(DataInputStream in) throws IOException {
    UTF8 ustr = TL_DATA.get().U_STR;
    ustr.readFields(in);
    return Long.parseLong(ustr.toString());
  }
View Full Code Here

    return Long.parseLong(ustr.toString());
  }

  /** write the long value */
  static void writeLongAsString(long value, DataOutputStream out) throws IOException {
    UTF8 ustr = TL_DATA.get().U_STR;
    ustr.set(toLogLong(value), true);
    ustr.write(out);
  }
View Full Code Here

    ustr.write(out);
  }
 
  /** read the long value */
  static short readShortAsString(DataInputStream in) throws IOException {
    UTF8 ustr = TL_DATA.get().U_STR;
    ustr.readFields(in);
    return Short.parseShort(ustr.toString());
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.io.UTF8$TempArrays

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.