danger.app
Class Resource

java.lang.Object
  extended by danger.app.Resource


public class Resource
extends Object

You can obtain a resource by using ResourceDatabase.getResource(int, int).

Most commonly, you will use other methods for using resources, such as ResourceDatabase.getAlert(int). You might access resources directly if you are using a custom resource type.


Method Summary
 int getByte(int offset)
          Read a single byte from a specified offset into the resource.
 void getBytes(byte[] dest, int offset, int count)
          Copy some number of bytes from a specified offset into the resource into the provided byte array.
 int getID()
          Obtain the ID of this resource
 InputStream getInputStream()
          Return an input stream corresponding to the data for this resource.
 int getInt(int offset)
          Read a little-endian integer from a specified offset into the resource.
 int getShort(int offset)
          Read a little-endian short from a specified offset into the resource.
 int getSize()
          Obtain the length of the data contained by this resource.
 int getType()
          Obtain the type code of this resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getType

public int getType()
Obtain the type code of this resource.

This can be one of ResourceDatabase.RSRC_STRING, ResourceDatabase.RSRC_BITMAP, etc.


getID

public int getID()
Obtain the ID of this resource


getSize

public int getSize()
Obtain the length of the data contained by this resource.


getByte

public int getByte(int offset)
Read a single byte from a specified offset into the resource.

Throws:
IndexOutOfBoundsException - if the offset is out of range

getShort

public int getShort(int offset)
Read a little-endian short from a specified offset into the resource.

Throws:
IndexOutOfBoundsException - if the offset is out of range

getInt

public int getInt(int offset)
Read a little-endian integer from a specified offset into the resource.

Throws:
IndexOutOfBoundsException - if the offset is out of range

getBytes

public void getBytes(byte[] dest,
                     int offset,
                     int count)
Copy some number of bytes from a specified offset into the resource into the provided byte array.

Throws:
IndexOutOfBoundsException - if the offset is out of range

getInputStream

public InputStream getInputStream()
Return an input stream corresponding to the data for this resource.