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

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

public interface Stringifier<T>
extends 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(String str)
          Restores the object from its string representation.
 String toString(T obj)
          Converts the object to a string representation
 

Method Detail

toString

String toString(T obj)
                throws IOException
Converts the object to a string representation

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

fromString

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

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

close

void close()
           throws IOException
Closes this object.

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


Copyright © 2008 The Apache Software Foundation