org.fuin.serialver4j.base
Class Utils

java.lang.Object
  extended by org.fuin.serialver4j.base.Utils

public final class Utils
extends Object

Helper class.


Method Summary
static com.thoughtworks.xstream.XStream createConfiguredXStream()
          Creates a ready initialized XStream instance.
static String getContent(String str, String beginTag, String endTag)
          Returns the content between the begin and the and tag.
static long getLongContent(String str, String beginTag, String endTag)
          Returns the content between the begin and the and tag as long value.
static long getSerialVersionUID(Class<?> clasz)
          Returns the serial version UID from a class.
static ClassesHistory readFromFile(File file)
          Reads the history from an XML file.
static void writeToFile(File file, ClassesHistory history)
          Writes the history into an XML file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

writeToFile

public static void writeToFile(File file,
                               ClassesHistory history)
                        throws IOException
Writes the history into an XML file.

Parameters:
file - Target file.
history - History to serialize into XML.
Throws:
IOException - Error writing the file.

readFromFile

public static ClassesHistory readFromFile(File file)
                                   throws IOException
Reads the history from an XML file.

Parameters:
file - XML file to read.
Returns:
History.
Throws:
IOException - Error reading the file.

getSerialVersionUID

public static long getSerialVersionUID(Class<?> clasz)
Returns the serial version UID from a class.

Parameters:
clasz - Class with static serial version UID field.
Returns:
Value of static serialVersionUID attribute.

getContent

public static String getContent(String str,
                                String beginTag,
                                String endTag)
                         throws ContentNotFoundException
Returns the content between the begin and the and tag.

Parameters:
str - Text to search within.
beginTag - Start tag.
endTag - End tag.
Returns:
Content between begin and and tag.
Throws:
ContentNotFoundException - The content cannot be extracted.

getLongContent

public static long getLongContent(String str,
                                  String beginTag,
                                  String endTag)
                           throws ContentNotFoundException
Returns the content between the begin and the and tag as long value.

Parameters:
str - Text to search within.
beginTag - Start tag.
endTag - End tag.
Returns:
Long value between begin and and tag.
Throws:
ContentNotFoundException - The content cannot be extracted.

createConfiguredXStream

public static com.thoughtworks.xstream.XStream createConfiguredXStream()
Creates a ready initialized XStream instance.

Returns:
New instance.


Copyright © 2011 Future Invent Informationsmanagement GmbH. All Rights Reserved.