Class ArchiveHelper
- java.lang.Object
-
- org.hibernate.boot.archive.internal.ArchiveHelper
-
public class ArchiveHelper extends Object
Helper for dealing with archives
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]
getBytesFromInputStream(InputStream inputStream)
Extracts the bytes out of an InputStream.static byte[]
getBytesFromInputStreamSafely(InputStream inputStream)
Extracts the bytes out of an InputStream.static URL
getJarURLFromURLEntry(URL url, String entry)
Get the JAR URL of the JAR containing the given entry Method used in a non managed environmentstatic URL
getURLFromPath(String jarPath)
get the URL from a given path string
-
-
-
Method Detail
-
getJarURLFromURLEntry
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 pointing to the known file in the JARentry
- file known to be in the JAR- Returns:
- the JAR URL
- Throws:
IllegalArgumentException
- if none URL is found
-
getURLFromPath
public static URL getURLFromPath(String jarPath)
get the URL from a given path string- Parameters:
jarPath
- The path that represents a URL- Returns:
- The resolved URL reference
- Throws:
IllegalArgumentException
- if something goes wrong
-
getBytesFromInputStreamSafely
public static byte[] getBytesFromInputStreamSafely(InputStream inputStream) throws ArchiveException
Extracts the bytes out of an InputStream. This form is the same asgetBytesFromInputStream(java.io.InputStream)
except that anyIOException
is wrapped as (runtime)ArchiveException
- Parameters:
inputStream
- The stream from which to extract bytes.- Returns:
- The bytes
- Throws:
ArchiveException
- Indicates a problem accessing the stream
-
getBytesFromInputStream
public static byte[] getBytesFromInputStream(InputStream inputStream) throws IOException
Extracts the bytes out of an InputStream.- Parameters:
inputStream
- The stream from which to extract bytes.- Returns:
- The bytes
- Throws:
IOException
- Indicates a problem accessing the stream- See Also:
getBytesFromInputStreamSafely(InputStream)
-
-