## org.apache.hadoop.typedbytes
Class TypedBytesOutput

    java.lang.Object
      org.apache.hadoop.typedbytes.TypedBytesOutput

    public class TypedBytesOutput

extends Object

Provides functionality for writing typed bytes.

Constructor Summary
`TypedBytesOutput(DataOutput out)` Creates a new instance of TypedBytesOutput.

Method Summary
`static TypedBytesOutput` `get(DataOutput out)` Get a thread-local typed bytes output for the supplied `DataOutput`.
`void` `write(Object obj)` Writes a Java object as a typed bytes sequence.
`void` `writeBool(boolean b)` Writes a boolean as a typed bytes sequence.
`void` `writeByte(byte b)` Writes a byte as a typed bytes sequence.
`void` `writeBytes(byte[] bytes)` Writes a bytes array as a typed bytes sequence.
`void` `writeBytes(byte[] bytes, int code)` Writes a bytes array as a typed bytes sequence, using a given typecode.
`void` `writeDouble(double d)` Writes a double as a typed bytes sequence.
`void` `writeFloat(float f)` Writes a float as a typed bytes sequence.
`void` `writeInt(int i)` Writes an integer as a typed bytes sequence.
`void` `writeList(List list)` Writes a list as a typed bytes sequence.
`void` `writeListFooter()` Writes a list footer.
`void` `writeListHeader()` Writes a list header.
`void` `writeLong(long l)` Writes a long as a typed bytes sequence.
`void` `writeMap(Map map)` Writes a map as a typed bytes sequence.
`void` `writeMapHeader(int length)` Writes a map header.
`void` `writeRaw(byte[] bytes)` Writes a raw sequence of typed bytes.
`void` `writeRaw(byte[] bytes, int offset, int length)` Writes a raw sequence of typed bytes.
`void` `writeString(String s)` Writes a string as a typed bytes sequence.
`void` `writeVector(ArrayList vector)` Writes a vector as a typed bytes sequence.
`void` `writeVectorHeader(int length)` Writes a vector header.

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

Constructor Detail

### TypedBytesOutput

    public TypedBytesOutput(DataOutput out)

  Creates a new instance of TypedBytesOutput.

Method Detail

### get

    public static TypedBytesOutput get(DataOutput out)

  Get a thread-local typed bytes output for the supplied `DataOutput`.

  Parameters:
    `out` - data output object
  Returns:
    typed bytes output corresponding to the supplied `DataOutput`.

### write

    public void write(Object obj)
               throws IOException

  Writes a Java object as a typed bytes sequence.

  Parameters:
    `obj` - the object to be written
  Throws:
    `IOException`

### writeRaw

    public void writeRaw(byte[] bytes)
                  throws IOException

  Writes a raw sequence of typed bytes.

  Parameters:
    `bytes` - the bytes to be written
  Throws:
    `IOException`

### writeRaw

    public void writeRaw(byte[] bytes,
                         int offset,
                         int length)
                  throws IOException

  Writes a raw sequence of typed bytes.

  Parameters:
    `bytes` - the bytes to be written
    `offset` - an offset in the given array
    `length` - number of bytes from the given array to write
  Throws:
    `IOException`

### writeBytes

    public void writeBytes(byte[] bytes,
                           int code)
                    throws IOException

  Writes a bytes array as a typed bytes sequence, using a given typecode.

  Parameters:
    `bytes` - the bytes array to be written
    `code` - the typecode to use
  Throws:
    `IOException`

### writeBytes

    public void writeBytes(byte[] bytes)
                    throws IOException

  Writes a bytes array as a typed bytes sequence.

  Parameters:
    `bytes` - the bytes array to be written
  Throws:
    `IOException`

### writeByte

    public void writeByte(byte b)
                   throws IOException

  Writes a byte as a typed bytes sequence.

  Parameters:
    `b` - the byte to be written
  Throws:
    `IOException`

### writeBool

    public void writeBool(boolean b)
                   throws IOException

  Writes a boolean as a typed bytes sequence.

  Parameters:
    `b` - the boolean to be written
  Throws:
    `IOException`

### writeInt

    public void writeInt(int i)
                  throws IOException

  Writes an integer as a typed bytes sequence.

  Parameters:
    `i` - the integer to be written
  Throws:
    `IOException`

### writeLong

    public void writeLong(long l)
                   throws IOException

  Writes a long as a typed bytes sequence.

  Parameters:
    `l` - the long to be written
  Throws:
    `IOException`

### writeFloat

    public void writeFloat(float f)
                    throws IOException

  Writes a float as a typed bytes sequence.

  Parameters:
    `f` - the float to be written
  Throws:
    `IOException`

### writeDouble

    public void writeDouble(double d)
                     throws IOException

  Writes a double as a typed bytes sequence.

  Parameters:
    `d` - the double to be written
  Throws:
    `IOException`

### writeString

    public void writeString(String s)
                     throws IOException

  Writes a string as a typed bytes sequence.

  Parameters:
    `s` - the string to be written
  Throws:
    `IOException`

### writeVector

    public void writeVector(ArrayList vector)
                     throws IOException

  Writes a vector as a typed bytes sequence.

  Parameters:
    `vector` - the vector to be written
  Throws:
    `IOException`

### writeVectorHeader

    public void writeVectorHeader(int length)
                           throws IOException

  Writes a vector header.

  Parameters:
    `length` - the number of elements in the vector
  Throws:
    `IOException`

### writeList

    public void writeList(List list)
                   throws IOException

  Writes a list as a typed bytes sequence.

  Parameters:
    `list` - the list to be written
  Throws:
    `IOException`

### writeListHeader

    public void writeListHeader()
                         throws IOException

  Writes a list header.

  Throws:
    `IOException`

### writeListFooter

    public void writeListFooter()
                         throws IOException

  Writes a list footer.

  Throws:
    `IOException`

### writeMap

    public void writeMap(Map map)
                  throws IOException

  Writes a map as a typed bytes sequence.

  Parameters:
    `map` - the map to be written
  Throws:
    `IOException`

### writeMapHeader

    public void writeMapHeader(int length)
                        throws IOException

  Writes a map header.

  Parameters:
    `length` - the number of key-value pairs in the map
  Throws:
    `IOException`

Copyright © 2009 The Apache Software Foundation