com.jrockit.memleak.mlp
Class MlpUtil

java.lang.Object
  extended by com.jrockit.memleak.mlp.MlpUtil

public class MlpUtil
extends java.lang.Object

Utility class to avoid polluting other classes with utility methods.

Author:
mpersson

Constructor Summary
MlpUtil()
           
 
Method Summary
static void log(java.lang.Exception e)
          Minimum effort exception logging.
static java.util.logging.Logger logger()
           
static java.util.BitSet readBitSet(java.io.DataInputStream in, int byteCount)
          Read bit set of byteCount bytes from a DataInputStream (in).
static
<E extends java.lang.Enum<E>>
java.util.EnumSet<E>
readEnumSet(java.lang.Class<E> enumType, java.io.DataInputStream in, int byteCount)
           
static
<E extends java.lang.Enum<E>>
java.util.EnumSet<E>
toEnumSet(java.lang.Class<E> enumType, java.util.BitSet bits)
          Convert a BitSet into an EnumSet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MlpUtil

public MlpUtil()
Method Detail

readBitSet

public static java.util.BitSet readBitSet(java.io.DataInputStream in,
                                          int byteCount)
                                   throws java.io.IOException
Read bit set of byteCount bytes from a DataInputStream (in).

Stream representation:

byte[byteCount] bytes

Where bit i is represented as
bytes[i>>3] & (1 << (i & 7)).

Parameters:
in - stream to read from
byteCount - number of bytes to read
Returns:
a BitSet
Throws:
java.io.IOException

toEnumSet

public static <E extends java.lang.Enum<E>> java.util.EnumSet<E> toEnumSet(java.lang.Class<E> enumType,
                                                                           java.util.BitSet bits)
Convert a BitSet into an EnumSet. Note that conversion of EnumSets into BitSets and vice versa is generally not a good serialization mechanism for EnumSets as it relies on the enum ordinals and bypasses the binary compatibility serialization of Enum and EnumSet. However, for efficient communication with non-Java code, it can be useful. It is recommended that the ordinals of Enums used with this method are explicitly specified and verified at construction time.

Type Parameters:
E -
Parameters:
enumType -
bits -
Returns:
an EnumSet

readEnumSet

public static <E extends java.lang.Enum<E>> java.util.EnumSet<E> readEnumSet(java.lang.Class<E> enumType,
                                                                             java.io.DataInputStream in,
                                                                             int byteCount)
                                                                  throws java.io.IOException
Type Parameters:
E -
Parameters:
enumType -
in - stream to read from
byteCount - number of bytes to read
Returns:
an EnumSet
Throws:
java.io.IOException

logger

public static java.util.logging.Logger logger()
Returns:
the logger for MLP

log

public static void log(java.lang.Exception e)
Minimum effort exception logging.

Parameters:
e -


Copyright © 1999, 2011, Oracle and/or its affiliates. All rights reserved.