Package javazoom.jl.decoder
Class JavaLayerUtils
- java.lang.Object
-
- javazoom.jl.decoder.JavaLayerUtils
-
public class JavaLayerUtils extends java.lang.Object
The JavaLayerUtils class is not strictly part of the JavaLayer API. It serves to provide useful methods and system-wide hooks.
-
-
Constructor Summary
Constructors Constructor Description JavaLayerUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Object
deserialize(java.io.InputStream in)
Deserializes an object from the givenInputStream
.static java.lang.Object
deserialize(java.io.InputStream in, java.lang.Class cls)
Deserializes the object contained in the given input stream.static java.lang.Object
deserializeArray(java.io.InputStream in, java.lang.Class elemType, int length)
Deserializes an array from a givenInputStream
.static java.lang.Object
deserializeArrayResource(java.lang.String name, java.lang.Class elemType, int length)
static JavaLayerHook
getHook()
static java.io.InputStream
getResourceAsStream(java.lang.String name)
Retrieves an InputStream for a named resource.static void
serialize(java.io.OutputStream out, java.lang.Object obj)
static void
setHook(JavaLayerHook hook0)
Sets the system-wide JavaLayer hook.
-
-
-
Method Detail
-
deserialize
public static java.lang.Object deserialize(java.io.InputStream in, java.lang.Class cls) throws java.io.IOException
Deserializes the object contained in the given input stream.- Parameters:
in
- The input stream to deserialize an object from.cls
- The expected class of the deserialized object.- Throws:
java.io.IOException
-
deserialize
public static java.lang.Object deserialize(java.io.InputStream in) throws java.io.IOException
Deserializes an object from the givenInputStream
. The deserialization is delegated to anObjectInputStream
instance.- Parameters:
in
- TheInputStream
to deserialize an object from.- Returns:
- The object deserialized from the stream.
- Throws:
java.io.IOException
- is thrown if there was a problem reading the underlying stream, or an object could not be deserialized from the stream.- See Also:
ObjectInputStream
-
deserializeArray
public static java.lang.Object deserializeArray(java.io.InputStream in, java.lang.Class elemType, int length) throws java.io.IOException
Deserializes an array from a givenInputStream
.- Parameters:
in
- TheInputStream
to deserialize an object from.elemType
- The class denoting the type of the array elements.length
- The expected length of the array, or -1 if any length is expected.- Throws:
java.io.IOException
-
deserializeArrayResource
public static java.lang.Object deserializeArrayResource(java.lang.String name, java.lang.Class elemType, int length) throws java.io.IOException
- Throws:
java.io.IOException
-
serialize
public static void serialize(java.io.OutputStream out, java.lang.Object obj) throws java.io.IOException
- Throws:
java.io.IOException
-
setHook
public static void setHook(JavaLayerHook hook0)
Sets the system-wide JavaLayer hook.
-
getHook
public static JavaLayerHook getHook()
-
getResourceAsStream
public static java.io.InputStream getResourceAsStream(java.lang.String name)
Retrieves an InputStream for a named resource.- Parameters:
name
- The name of the resource. This must be a simple name, and not a qualified package name.- Returns:
- The InputStream for the named resource, or null if the resource has not been found. If a hook has been provided, its getResourceAsStream() method is called to retrieve the resource.
-
-