Top Description Constructors Methods
org.hibernate.bytecode.util

public Class ByteCodeHelper

extends Object
Class Inheritance
Imports
java.io.InputStream, .IOException, .File, .FileInputStream, .ByteArrayOutputStream, .BufferedInputStream, java.util.zip.ZipInputStream

A helper for reading byte code from various input sources.
Author
Steve Ebersole

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static byte[]

Returns:

The read bytes
readByteCode
(InputStream
The stream containing the class binary; null will lead to an IOException
inputStream
)

Reads class byte array info from the given input stream.

public static byte[]

Returns:

The class bytes
readByteCode
(File
The file to read.
file
)

Read class definition from a file.

public static byte[]

Returns:

The class bytes
readByteCode
(ZipInputStream
The zip entry stream.
zip
)

Read class definition a zip (jar) file entry.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ByteCodeHelperback to summary
private ByteCodeHelper()

Method Detail

readByteCodeback to summary
public static byte[] readByteCode(InputStream inputStream) throws IOException

Reads class byte array info from the given input stream.

The stream is closed within this method!

Parameters
inputStream:InputStream

The stream containing the class binary; null will lead to an IOException

Returns:byte[]

The read bytes

Exceptions
IOException:
Indicates a problem accessing the given stream.
readByteCodeback to summary
public static byte[] readByteCode(File file) throws IOException

Read class definition from a file.

Parameters
file:File

The file to read.

Returns:byte[]

The class bytes

Exceptions
IOException:
Indicates a problem accessing the given stream.
readByteCodeback to summary
public static byte[] readByteCode(ZipInputStream zip) throws IOException

Read class definition a zip (jar) file entry.

Parameters
zip:ZipInputStream

The zip entry stream.

Returns:byte[]

The class bytes

Exceptions
IOException:
Indicates a problem accessing the given stream.