com.jme3.asset.TextLoader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jme3-core Show documentation
Show all versions of jme3-core Show documentation
jMonkeyEngine is a 3-D game engine for adventurous Java developers
The newest version!
package com.jme3.asset;
import java.util.Scanner;
/**
* An example implementation of {@link AssetLoader} to load text
* files as strings.
*/
public class TextLoader implements AssetLoader {
@Override
public Object load(AssetInfo assetInfo) {
Scanner scan = new Scanner(assetInfo.openStream());
StringBuilder sb = new StringBuilder();
try {
while (scan.hasNextLine()) {
sb.append(scan.nextLine()).append('\n');
}
} finally {
scan.close();
}
return sb.toString();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy