Top Description Fields Constructors Methods
org.hibernate.boot.archive.internal

public Class ArchiveHelper

extends Object
Class Inheritance
Imports
java.io.File, .IOException, .InputStream, java.net.MalformedURLException, .URL, java.util.LinkedList, .List, org.hibernate.boot.archive.spi.ArchiveException, org.jboss.logging.Logger

Helper for dealing with archives
Authors
Emmanuel Bernard, Steve Ebersole

Field Summary

Modifier and TypeField and Description
private static final Logger

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static byte[]

Returns:

The bytes
getBytesFromInputStream
(InputStream
The stream from which to extract bytes.
inputStream
)

Extracts the bytes out of an InputStream.

public static byte[]

Returns:

The bytes
getBytesFromInputStreamSafely
(InputStream
The stream from which to extract bytes.
inputStream
)

Extracts the bytes out of an InputStream.

public static URL

Returns:

the JAR URL
getJarURLFromURLEntry
(URL
URL pointing to the known file in the JAR
url
,
String
file known to be in the JAR
entry
)

Get the JAR URL of the JAR containing the given entry Method used in a non managed environment

public static URL

Returns:

The resolved URL reference
getURLFromPath
(String
The path that represents a URL
jarPath
)

get the URL from a given path string

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

logback to summary
private static final Logger log

Constructor Detail

ArchiveHelperback to summary
private ArchiveHelper()

Method Detail

getBytesFromInputStreamback to summary
public static byte[] getBytesFromInputStream(InputStream inputStream) throws IOException

Extracts the bytes out of an InputStream.

Parameters
inputStream:InputStream

The stream from which to extract bytes.

Returns:byte[]

The bytes

Exceptions
IOException:
Indicates a problem accessing the stream
See Also
getBytesFromInputStreamSafely(java.io.InputStream)
getBytesFromInputStreamSafelyback to summary
public static byte[] getBytesFromInputStreamSafely(InputStream inputStream) throws ArchiveException

Extracts the bytes out of an InputStream. This form is the same as getBytesFromInputStream except that any IOException is wrapped as (runtime) ArchiveException

Parameters
inputStream:InputStream

The stream from which to extract bytes.

Returns:byte[]

The bytes

Exceptions
ArchiveException:
Indicates a problem accessing the stream
getJarURLFromURLEntryback to summary
public static URL getJarURLFromURLEntry(URL url, String entry) throws IllegalArgumentException

Get the JAR URL of the JAR containing the given entry Method used in a non managed environment

Parameters
url:URL

URL pointing to the known file in the JAR

entry:String

file known to be in the JAR

Returns:URL

the JAR URL

Exceptions
IllegalArgumentException:
if none URL is found
getURLFromPathback to summary
public static URL getURLFromPath(String jarPath)

get the URL from a given path string

Parameters
jarPath:String

The path that represents a URL

Returns:URL

The resolved URL reference

Exceptions
IllegalArgumentException:
if something goes wrong