|
PulpCore | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pulpcore.Assets
public class Assets
The Assets class provided a central location to retrieve game assets (images, fonts, sounds, etc.) from the jar or from zip files.
Method Summary | |
---|---|
static boolean |
addCatalog(String catalogName,
byte[] zipFileData)
Adds the contents of an asset catalog (zip file) into memory. |
static boolean |
addCatalog(String catalogName,
InputStream is)
Adds the contents of an asset catalog (zip file) into memory. |
static boolean |
containsAsset(String assetName)
Returns true if the specified asset in any zip file exists. |
static boolean |
containsCatalog(String catalogName)
Checks if the specified catalog name (zip file) is stored in memory. |
static ByteArray |
get(String assetName)
Gets an asset as a ByteArray . |
static Iterator |
getAssetNames()
Gets an iterator of the names of all assets from all zip files stored in memory. |
static InputStream |
getAsStream(String assetName)
Gets an asset as an InputStream . |
static Iterator |
getCatalogs()
Gets an iterator of catalog names (zip files) stored in memory. |
static void |
removeAsset(String assetName)
Removes a specific asset from memory. |
static void |
removeCatalog(String catalogName)
Removes all assets downloaded from the specified catalog (zip file). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static boolean addCatalog(String catalogName, byte[] zipFileData)
If this catalog contains an asset that has the same name as an existing asset, the old asset is replaced with the new one. If this zip file contains errors, no existing assets are affected and this method returns false.
zipFileData
- a zip file
public static boolean addCatalog(String catalogName, InputStream is)
If this catalog contains an asset that has the same name as an existing asset, the old asset is replaced with the new one. If this zip file contains errors, no existing assets are affected and this method returns false.
is
- an input stream that points to the contents of a zip file.
public static Iterator getCatalogs()
public static boolean containsCatalog(String catalogName)
public static void removeCatalog(String catalogName)
public static Iterator getAssetNames()
public static boolean containsAsset(String assetName)
public static void removeAsset(String assetName)
public static ByteArray get(String assetName)
ByteArray
.
This method first checks the downloaded asset catalogs, then the jar file. For some platforms (Applets), the originating server is also checked if the asset is not in the zip file(s) or the jar file. Returns null if the asset was not found.
The returned ByteArray's position is set to zero.
public static InputStream getAsStream(String assetName)
InputStream
.
This method first checks the downloaded asset catalogs, then the jar file. For some platforms (Applets), the originating server is also checked if the asset is not in the zip file(s) or the jar file. Returns null if the asset was not found.
|
PulpCore | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |