Top Description Fields Constructors Methods
jdk.internal.loader

public abstract Class Resource

extends Object
Class Inheritance
Imports
java.io.EOFException, .IOException, .InterruptedIOException, .InputStream, java.net.URL, java.security.CodeSigner, java.util.jar.Manifest, java.nio.ByteBuffer, java.util.Arrays, sun.nio.ByteBuffered

This class is used to represent a Resource that has been loaded from the class path.
Author
David Connelly
Since
1.2

Field Summary

Modifier and TypeField and Description
private InputStream

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private synchronized InputStream
public ByteBuffer

Returns:

Resource data or null.
getByteBuffer
()

Returns the Resource data as a ByteBuffer, but only if the input stream was implemented on top of a ByteBuffer.

public byte[]
getBytes()

Returns the Resource data as an array of bytes.

public Certificate[]
getCertificates()

Returns theCertificates for the Resource, or null if none.

public CodeSigner[]
getCodeSigners()

Returns the code signers for the Resource, or null if none.

public abstract URL
getCodeSourceURL()

Returns the CodeSource URL for the Resource.

public abstract int
getContentLength()

Returns the length of the Resource data, or -1 if unknown.

public Exception
getDataError()

Returns non-fatal reading error during data retrieval if there's any.

public abstract InputStream
getInputStream()

Returns an InputStream for reading the Resource data.

public Manifest
getManifest()

Returns the Manifest for the Resource, or null if none.

public abstract String
getName()

Returns the name of the Resource.

public abstract URL
getURL()

Returns the URL of the Resource.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cisback to summary
private InputStream cis

Constructor Detail

Resourceback to summary
public Resource()

Method Detail

cachedInputStreamback to summary
private synchronized InputStream cachedInputStream() throws IOException
getByteBufferback to summary
public ByteBuffer getByteBuffer() throws IOException

Returns the Resource data as a ByteBuffer, but only if the input stream was implemented on top of a ByteBuffer. Return null otherwise.

Returns:ByteBuffer

Resource data or null.

getBytesback to summary
public byte[] getBytes() throws IOException

Returns the Resource data as an array of bytes.

getCertificatesback to summary
public Certificate[] getCertificates()

Returns theCertificates for the Resource, or null if none.

getCodeSignersback to summary
public CodeSigner[] getCodeSigners()

Returns the code signers for the Resource, or null if none.

getCodeSourceURLback to summary
public abstract URL getCodeSourceURL()

Returns the CodeSource URL for the Resource.

getContentLengthback to summary
public abstract int getContentLength() throws IOException

Returns the length of the Resource data, or -1 if unknown.

getDataErrorback to summary
public Exception getDataError()

Returns non-fatal reading error during data retrieval if there's any. For example, CRC error when reading a JAR entry.

getInputStreamback to summary
public abstract InputStream getInputStream() throws IOException

Returns an InputStream for reading the Resource data.

getManifestback to summary
public Manifest getManifest() throws IOException

Returns the Manifest for the Resource, or null if none.

getNameback to summary
public abstract String getName()

Returns the name of the Resource.

getURLback to summary
public abstract URL getURL()

Returns the URL of the Resource.