SerDeUtils (apache-cassandra API)
Date: 2012-05-04

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cassandra.io
Class SerDeUtils

    java.lang.Object
      org.apache.cassandra.io.SerDeUtils

    public final class SerDeUtils

extends java.lang.Object

Static serialization/deserialization utility functions, intended to eventually replace IVersionedSerializers.

Constructor Summary
`SerDeUtils()`

Method Summary
`static
`<T> org.apache.avro.generic.GenericArray<T>`
` | `createArray(int size, org.apache.avro.Schema schema)` Create a generic array of the given type and size.
`static java.io.DataInputStream` | `createDataInputStream(java.nio.ByteBuffer buff)`
`static
`<T extends org.apache.avro.specific.SpecificRecord> T`
` | `deserialize(org.apache.avro.Schema writer, java.nio.ByteBuffer bytes, T ob)` Deserializes a single object based on the given Schema.
`static
`<T extends org.apache.avro.specific.SpecificRecord> T`
` | `deserializeWithSchema(java.nio.ByteBuffer bytes, T ob)` Deserializes a single object as stored along with its Schema by serialize(T).
`static
`<T extends org.apache.avro.specific.SpecificRecord> java.nio.ByteBuffer`
` | `serialize(T o)` Serializes a single object.
`static
`<T extends org.apache.avro.specific.SpecificRecord> java.nio.ByteBuffer`
` | `serializeWithSchema(T o)` Serializes a single object along with its Schema.

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

Constructor Detail

### SerDeUtils

    public SerDeUtils()

Method Detail

### deserialize

    public static <T extends org.apache.avro.specific.SpecificRecord> T deserialize(org.apache.avro.Schema writer,
                                                                                    java.nio.ByteBuffer bytes,
                                                                                    T ob)
                                                                         throws java.io.IOException

  Deserializes a single object based on the given Schema.

  Parameters:
    `writer` - writer's schema
    `bytes` - Array to deserialize from
    `ob` - An empty object to deserialize into (must not be null).
  Throws:
    `java.io.IOException`

### serialize

    public static <T extends org.apache.avro.specific.SpecificRecord> java.nio.ByteBuffer serialize(T o)
                                         throws java.io.IOException

  Serializes a single object.

  Parameters:
    `o` - Object to serialize
  Throws:
    `java.io.IOException`

### deserializeWithSchema

    public static <T extends org.apache.avro.specific.SpecificRecord> T deserializeWithSchema(java.nio.ByteBuffer bytes,
                                                                                              T ob)
                                                                                   throws java.io.IOException

  Deserializes a single object as stored along with its Schema by serialize(T). NB: See warnings on serialize(T).

  Parameters:
    `ob` - An empty object to deserialize into (must not be null).
    `bytes` - Array to deserialize from
  Throws:
    `java.io.IOException`

### serializeWithSchema

    public static <T extends org.apache.avro.specific.SpecificRecord> java.nio.ByteBuffer serializeWithSchema(T o)
                                                   throws java.io.IOException

  Serializes a single object along with its Schema. NB: For performance critical areas, it is much more efficient to store the Schema independently.

  Parameters:
    `o` - Object to serialize
  Throws:
    `java.io.IOException`

### createDataInputStream

    public static java.io.DataInputStream createDataInputStream(java.nio.ByteBuffer buff)

  Returns:
    a DataInputStream wrapping the given buffer.

### createArray

    public static <T> org.apache.avro.generic.GenericArray<T> createArray(int size,
                                                                          org.apache.avro.Schema schema)

  Create a generic array of the given type and size. Mostly to minimize imports.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012 The Apache Software Foundation