public class ArchiveHelper extends Object
Modifier and Type | Method and 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 environment
|
static URL |
getURLFromPath(String jarPath)
get the URL from a given path string
|
public static URL getJarURLFromURLEntry(URL url, String entry) throws IllegalArgumentException
url
- URL pointing to the known file in the JARentry
- file known to be in the JARIllegalArgumentException
- if none URL is foundpublic static URL getURLFromPath(String jarPath)
jarPath
- The path that represents a URLIllegalArgumentException
- is something goes wrongpublic static byte[] getBytesFromInputStreamSafely(InputStream inputStream) throws ArchiveException
getBytesFromInputStream(java.io.InputStream)
except that any IOException
are wrapped as (runtime) ArchiveException
inputStream
- The stream from which to extract bytes.ArchiveException
- Indicates a problem accessing the streampublic static byte[] getBytesFromInputStream(InputStream inputStream) throws IOException
inputStream
- The stream from which to extract bytes.IOException
- Indicates a problem accessing the streamgetBytesFromInputStreamSafely(java.io.InputStream)
Copyright © 2019 JBoss by Red Hat. All rights reserved.