## org.apache.hadoop.io
Class UTF8

    java.lang.Object
      org.apache.hadoop.io.UTF8

All Implemented Interfaces:
  Comparable, Writable, WritableComparable

Deprecated. replaced by Text

    public class UTF8

extends Object
implements WritableComparable

A WritableComparable for strings that uses the UTF8 encoding.

Also includes utilities for efficiently reading and writing UTF-8.

Nested Class Summary
`static class` `UTF8.Comparator` Deprecated. A WritableComparator optimized for UTF8 keys.

Constructor Summary
`UTF8()` Deprecated.
`UTF8(String string)` Deprecated. Construct from a given string.
`UTF8(UTF8 utf8)` Deprecated. Construct from a given string.

Method Summary
`int` `compareTo(Object o)` Deprecated. Compare two UTF8s.
`boolean` `equals(Object o)` Deprecated. Returns true iff `o` is a UTF8 with the same contents.
`byte[]` `getBytes()` Deprecated. The raw bytes.
`static byte[]` `getBytes(String string)` Deprecated. Convert a string to a UTF-8 encoded byte array.
`int` `getLength()` Deprecated. The number of bytes in the encoded string.
`int` `hashCode()` Deprecated.
`void` `readFields(DataInput in)` Deprecated. Deserialize the fields of this object from `in`.
`static String` `readString(DataInput in)` Deprecated. Read a UTF-8 encoded string.
`void` `set(String string)` Deprecated. Set to contain the contents of a string.
`void` `set(UTF8 other)` Deprecated. Set to contain the contents of a string.
`static void` `skip(DataInput in)` Deprecated. Skips over one UTF8 in the input.
`String` `toString()` Deprecated. Convert to a String.
`void` `write(DataOutput out)` Deprecated. Serialize the fields of this object to `out`.
`static int` `writeString(DataOutput out, String s)` Deprecated. Write a UTF-8 encoded string.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### UTF8

    public UTF8()

  Deprecated.

### UTF8

    public UTF8(String string)

  Deprecated.
  Construct from a given string.

### UTF8

    public UTF8(UTF8 utf8)

  Deprecated.
  Construct from a given string.

Method Detail

### getBytes

    public byte[] getBytes()

  Deprecated.
  The raw bytes.

### getLength

    public int getLength()

  Deprecated.
  The number of bytes in the encoded string.

### set

    public void set(String string)

  Deprecated.
  Set to contain the contents of a string.

### set

    public void set(UTF8 other)

  Deprecated.
  Set to contain the contents of a string.

### readFields

    public void readFields(DataInput in)
                    throws IOException

  Deprecated.
  Description copied from interface: `Writable`
  Deserialize the fields of this object from `in`.

  For efficiency, implementations should attempt to re-use storage in the existing object where possible.

  Specified by:
    `readFields` in interface `Writable`
  Parameters:
    `in` - `DataInput` to deseriablize this object from.
  Throws:
    `IOException`

### skip

    public static void skip(DataInput in)
                     throws IOException

  Deprecated.
  Skips over one UTF8 in the input.

  Throws:
    `IOException`

### write

    public void write(DataOutput out)
               throws IOException

  Deprecated.
  Description copied from interface: `Writable`
  Serialize the fields of this object to `out`.

  Specified by:
    `write` in interface `Writable`
  Parameters:
    `out` - `DataOuput` to serialize this object into.
  Throws:
    `IOException`

### compareTo

    public int compareTo(Object o)

  Deprecated.
  Compare two UTF8s.

  Specified by:
    `compareTo` in interface `Comparable`

### toString

    public String toString()

  Deprecated.
  Convert to a String.

  Overrides:
    `toString` in class `Object`

### equals

    public boolean equals(Object o)

  Deprecated.
  Returns true iff `o` is a UTF8 with the same contents.

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Deprecated.
  Overrides:
    `hashCode` in class `Object`

### getBytes

    public static byte[] getBytes(String string)

  Deprecated.
  Convert a string to a UTF-8 encoded byte array.

  See Also:
    `String.getBytes(String)`

### readString

    public static String readString(DataInput in)
                             throws IOException

  Deprecated.
  Read a UTF-8 encoded string.

  Throws:
    `IOException`
  See Also:
    `DataInput.readUTF()`

### writeString

    public static int writeString(DataOutput out,
                                  String s)
                           throws IOException

  Deprecated.
  Write a UTF-8 encoded string.

  Throws:
    `IOException`
  See Also:
    `DataOutput.writeUTF(String)`

Copyright © 2009 The Apache Software Foundation