org.knime.core.node.util
Class ConvenienceMethods

java.lang.Object
  extended by org.knime.core.node.util.ConvenienceMethods

public final class ConvenienceMethods
extends Object

Collection of methods that are useful in different contexts.

Author:
Bernd Wiswedel, University of Konstanz

Method Summary
static boolean areEqual(Object o1, Object o2)
          Determines if both arguments are equal according to their equals method (assumed to be symmetric).
static String getLineSeparator()
          Read system property "line.separator", returns '\n' if that fails (whereby a LOG message is reported).
static long readSizeSystemProperty(String envVar, long defaultValue)
          Read system property envVar that is supposed to be of a format such as '1024' (1024 bytes), '5K' (5 kilobyte), '2M' (2 megabyte).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

areEqual

public static boolean areEqual(Object o1,
                               Object o2)
Determines if both arguments are equal according to their equals method (assumed to be symmetric). This method handles null arguments.

Parameters:
o1 - First object for comparison, may be null.
o2 - Second object for comparison, may be null.
Returns:
If both arguments are equal (if either one is null, so must be the other one)

getLineSeparator

public static String getLineSeparator()
Read system property "line.separator", returns '\n' if that fails (whereby a LOG message is reported).

Returns:
The system line separator, never null.

readSizeSystemProperty

public static long readSizeSystemProperty(String envVar,
                                          long defaultValue)
Read system property envVar that is supposed to be of a format such as '1024' (1024 bytes), '5K' (5 kilobyte), '2M' (2 megabyte). If that fails (not parsable or negative), it will return the the default value and log an error message.

Parameters:
envVar - The name of the variable, must not be null (NPE)
defaultValue - The default value (in bytes)
Returns:
The size parameters in bytes or the defaultValue if the value can't be parsed.


Copyright, 2003 - 2012. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.