public class ArchiveHelper
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static byte[] |
getBytesFromInputStream(java.io.InputStream inputStream)
Extracts the bytes out of an InputStream.
|
static byte[] |
getBytesFromInputStreamSafely(java.io.InputStream inputStream)
Extracts the bytes out of an InputStream.
|
static java.net.URL |
getJarURLFromURLEntry(java.net.URL url,
java.lang.String entry)
Get the JAR URL of the JAR containing the given entry
Method used in a non managed environment
|
static java.net.URL |
getURLFromPath(java.lang.String jarPath)
get the URL from a given path string
|
public static java.net.URL getJarURLFromURLEntry(java.net.URL url, java.lang.String entry) throws java.lang.IllegalArgumentException
url
- URL pointing to the known file in the JARentry
- file known to be in the JARjava.lang.IllegalArgumentException
- if none URL is foundpublic static java.net.URL getURLFromPath(java.lang.String jarPath)
jarPath
- The path that represents a URLjava.lang.IllegalArgumentException
- is something goes wrongpublic static byte[] getBytesFromInputStreamSafely(java.io.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(java.io.InputStream inputStream) throws java.io.IOException
inputStream
- The stream from which to extract bytes.java.io.IOException
- Indicates a problem accessing the streamgetBytesFromInputStreamSafely(java.io.InputStream)
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.