ariba.util.core
Class TableUtil

java.lang.Object
  extended by ariba.util.core.TableUtil

public final class TableUtil
extends java.lang.Object

Table file Utilities. These are helper functions for dealing with table files.


Method Summary
static java.util.Map loadMap(java.io.File file)
          Load a serialized Map from the given file.
static java.util.Map loadMap(java.io.File file, boolean displayError)
          Load a serialized Map from the given url.
static java.util.Map loadMap(java.lang.String s, boolean displayError)
          Load a serialized Map from the given String.
static java.util.Map loadMap(java.net.URL url)
          Load a serialized Map from the given url.
static java.util.Map loadMap(java.net.URL url, boolean displayError)
          Load a serialized Map from the given url.
static java.lang.Object loadObject(java.io.File file)
          Load an object from a file using loadObject(Reader)
static java.lang.Object loadObject(java.io.File file, java.lang.String encoding)
          Load an object from a file using loadObject(Reader)
static java.lang.Object loadObject(java.io.Reader reader)
          Load an object from a stream.
static java.lang.Object loadObject(java.net.URL url)
          Load an object from a URL using loadObject(Reader)
static void main(java.lang.String[] args)
           
static boolean safeWriteObject(java.io.File file, java.lang.Object object)
          Writes an object to a file in safe way.
static boolean writeObject(java.io.File file, java.lang.Object object)
          Write an object to a file.
static boolean writeObject(java.io.OutputStream outputStream, java.lang.Object object)
          Write an object to an OutputStream.
static boolean writeObject(java.io.PrintWriter printWriter, java.lang.Object object)
          Write an object to a printWriter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

loadMap

public static java.util.Map loadMap(java.io.File file)
Load a serialized Map from the given file. The format of the file should be that of calling a Map's toString() method.

Parameters:
file - the File to load the serialized Map from
Returns:
the Map loaded from the file

loadMap

public static java.util.Map loadMap(java.io.File file,
                                    boolean displayError)
Load a serialized Map from the given url. The format of the contents should be that of calling a Map's toString() method.

Parameters:
file - the File to load the serialized Map from
displayError - if true and there are errors deserializing the Map, an error will be printed.
Returns:
the Map loaded from the url, null if the map cannot be loaded.

loadMap

public static java.util.Map loadMap(java.net.URL url)
Load a serialized Map from the given url. The format of the contents should be that of calling a Map's toString() method.

Parameters:
url - the URL to load the serialized Map from
Returns:
the Map loaded from the url

loadMap

public static java.util.Map loadMap(java.net.URL url,
                                    boolean displayError)
Load a serialized Map from the given url. The format of the contents should be that of calling a Map's toString() method.

Parameters:
url - the URL to load the serialized Map from
displayError - if true and there are errors deserializing the Map, an error will be printed.
Returns:
the Map loaded from the url

loadMap

public static java.util.Map loadMap(java.lang.String s,
                                    boolean displayError)
Load a serialized Map from the given String. The format of the contents should be that of calling a Map's toString() method.

Parameters:
s - the String to load the serialized Map from
displayError - if true and there are errors deserializing the Map, an error will be printed.
Returns:
the Map loaded from the url

loadObject

public static java.lang.Object loadObject(java.net.URL url)
Load an object from a URL using loadObject(Reader)

Parameters:
url - the URL to load the object from
Returns:
the deserialized object, or null if there was an IOException.
See Also:
loadObject(Reader)

loadObject

public static java.lang.Object loadObject(java.io.File file)
Load an object from a file using loadObject(Reader)

Parameters:
file - the path for the file to load the object from
Returns:
the deserialized object, or null if there was an IOException.
See Also:
loadObject(Reader)

loadObject

public static java.lang.Object loadObject(java.io.File file,
                                          java.lang.String encoding)
Load an object from a file using loadObject(Reader)

Parameters:
file - the path for the file to load the object from
encoding - the encoding used for file reader
Returns:
the deserialized object, or null if there was an IOException.
See Also:
loadObject(Reader)

loadObject

public static java.lang.Object loadObject(java.io.Reader reader)
                                   throws java.io.IOException
Load an object from a stream. Uses the Deserializer class from ariba.util.io to decode the data.

Parameters:
reader - the source for the Object's data
Returns:
the deserialized Object.
Throws:
java.io.IOException - if there was an error deserializing the object.

safeWriteObject

public static boolean safeWriteObject(java.io.File file,
                                      java.lang.Object object)
Writes an object to a file in safe way. This method is similar to writeObject but it actually uses the FileReplacer to be more robust.

Parameters:
file - the path for a file to write the object to
object - the Object to serialize into the file
Returns:
true if the object was written successfully false otherwise

writeObject

public static boolean writeObject(java.io.File file,
                                  java.lang.Object object)
Write an object to a file.

Parameters:
file - the path for a file to write the object to
object - the Object to serialize into the file
Returns:
true if the object was written successfully false otherwise

writeObject

public static boolean writeObject(java.io.OutputStream outputStream,
                                  java.lang.Object object)
Write an object to an OutputStream.

Parameters:
outputStream - the OutputStream to write the object to
object - the Object to serialize into the file
Returns:
true if the object was written successfully false otherwise

writeObject

public static boolean writeObject(java.io.PrintWriter printWriter,
                                  java.lang.Object object)
Write an object to a printWriter.

Parameters:
printWriter - the PrintWriter to write the object to
object - the Object to serialize into the file
Returns:
true if the object was written successfully false otherwise

main

public static void main(java.lang.String[] args)


AribaWeb User Interface Development Framework
Copyright © 2000-2014 Ariba, Inc. All Rights Reserved.