Package javacard.framework
Class Resources
- java.lang.Object
-
- javacard.framework.Resources
-
public final class Resources extends Object
An instance ofResources
provides means to read the resources accessible to the caller code.The resources are data files deployed within a CAP file (application or library). Each resource file is named using a 16-bit identifier which is local to the CAP file containing it.
The resources are only accessible to the code within the CAP file containing these resources. It is the responsibility of the code in this CAP file to keep the resource data private or to provide entry points to share it outside of this module.- Since:
- 3.1
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Resources
getResources()
Get the JCRE-owned instanceResources
object to access resourcesshort
getSize(short resourceId)
Get the size in bytes of the specified resource identifierbyte[]
getView(short resourceId)
Creates a read-only view of the bytes of the specified resourcebyte[]
getView(short resourceId, short ofs, short len)
Creates a read-only view of the specified range within a resource
-
-
-
Method Detail
-
getResources
public static Resources getResources()
Get the JCRE-owned instanceResources
object to access resources- Returns:
- the resources accessible to the caller
-
getSize
public short getSize(short resourceId) throws IOException
Get the size in bytes of the specified resource identifier- Parameters:
resourceId
- the identifier of the resource to lookup- Returns:
- the size in bytes of the specified resource
- Throws:
IOException
- if the resource is not found
-
getView
public byte[] getView(short resourceId) throws IOException
Creates a read-only view of the bytes of the specified resource- Parameters:
resourceId
- the identifier of the resource to lookup- Returns:
- a read-only view on the resource bytes
- Throws:
IOException
- if the resource is not found
-
getView
public byte[] getView(short resourceId, short ofs, short len) throws IOException
Creates a read-only view of the specified range within a resource- Parameters:
resourceId
- the identifier of the resource to lookupofs
- the starting offsetlen
- the length in bytes- Returns:
- a read-only view on the resource bytes
- Throws:
IOException
- if the resource is not found or if the offset and length are incorrect or exceed resource size
-
-