public final class UtilityMedia extends Object
HDD
, JAR
...
Example:
Engine.start("First Code", Version.create(1, 0, 0), "resources"); final Media media = Media.get("img", "image.png"); System.out.println(media.getPath()); // print: resources/img/image.png
Modifier and Type | Field and Description |
---|---|
static String |
SYSTEM_TEMP_DIR
System temp directory.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
createPath(String source,
String... path)
Create a full path and each directory.
|
static Media |
get(String... path)
Get a media from its path (start by default in the resources directory).
|
static String |
getFilenameFromPath(String path)
Get the filename from a path (last part of a path, after the last separator).
|
static OutputStream |
getOutputStream(Media media,
String from,
boolean logger)
Get output stream of specified path.
|
static String |
getPath(String... path)
Construct a usable path using a list of string, automatically separated by the portable separator.
|
static String |
getPathSeparator(String separator,
String... path)
Construct a usable path using a list of string, automatically separated by the portable separator.
|
static String |
getSeparator()
Get current separator character (equals / in case of applet, else OS dependent).
|
static InputStream |
getStream(Media media,
String from)
Get stream of specified path.
|
static InputStream |
getStream(Media media,
String from,
boolean logger)
Get stream of specified path.
|
static String |
getTempDir()
Get temporary directory (where are stored files from jar).
|
public static final String SYSTEM_TEMP_DIR
public static boolean createPath(String source, String... path)
source
- The source directory.path
- The full path.true
if created, false
else.public static Media get(String... path)
Example: Media.get("sprites", "hero.png")
will return resources/sprites/hero.png
. This
function is OS independent !
path
- The list of folders (if has) and file.public static String getPath(String... path)
path
- The list of folders (if has) and file.public static String getPathSeparator(String separator, String... path)
separator
- The separator to use.path
- The list of folders (if has) and file.public static InputStream getStream(Media media, String from)
media
- The input media path, pointing to a file.from
- The from function.public static InputStream getStream(Media media, String from, boolean logger)
media
- The input media path, pointing to a file.from
- The from function.logger
- The logger flag.public static OutputStream getOutputStream(Media media, String from, boolean logger)
media
- The input media path, pointing to a file.from
- The from function.logger
- The logger flag.public static String getFilenameFromPath(String path)
path
- The path used to extract filename.public static String getTempDir()
/tmp, .../AppData/Local/Temp, ...
)public static String getSeparator()
Copyright © 2014 Byron 3D Games Studio. All rights reserved.