org.apache.hadoop.io
Interface Stringifier<T>

Type Parameters:
T - the class of the objects to stringify
All Superinterfaces:
java.io.Closeable
All Known Implementing Classes:
DefaultStringifier

public interface Stringifier<T>
extends java.io.Closeable

Stringifier interface offers two methods to convert an object to a string representation and restore the object given its string representation.


Method Summary
 void close()
          Closes this object.
 T fromString(java.lang.String str)
          Restores the object from its string representation.
 java.lang.String toString(T obj)
          Converts the object to a string representation
 

Method Detail

toString

java.lang.String toString(T obj)
                          throws java.io.IOException
Converts the object to a string representation

Parameters:
obj - the object to convert
Returns:
the string representation of the object
Throws:
java.io.IOException - if the object cannot be converted

fromString

T fromString(java.lang.String str)
             throws java.io.IOException
Restores the object from its string representation.

Parameters:
str - the string representation of the object
Returns:
restored object
Throws:
java.io.IOException - if the object cannot be restored

close

void close()
           throws java.io.IOException
Closes this object.

Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException - if an I/O error occurs


Copyright © 2009 The Apache Software Foundation