本文整理匯總了Java中com.badlogic.gdx.files.FileHandle.file方法的典型用法代碼示例。如果您正苦於以下問題:Java FileHandle.file方法的具體用法?Java FileHandle.file怎麽用?Java FileHandle.file使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.files.FileHandle
的用法示例。
在下文中一共展示了FileHandle.file方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: ZipModInputStream
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
public ZipModInputStream(FileHandle file) {
try {
inputStream = new FileInputStream(file.file());
zipInputStream = new ZipInputStream(inputStream);
fileStream = new FilterInputStream(zipInputStream) {
@Override
public void close() throws IOException {
// no close
}
};
} catch (Exception e) {
try {
close();
} catch (IOException ignored) {
}
throw new CubesException("Failed to create zip mod input stream", e);
}
}
示例2: createSceneFile
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
private FileHandle createSceneFile(float width,float height,String name) throws IOException {
if (!path.isDirectory()){
path = path.parent();
}
StringBuilder filePath = new StringBuilder();
filePath.append(path.path());
filePath.append("/");
filePath.append(name);
filePath.append(".");
filePath.append(Config.sceneExtension);
FileHandle fileHandle = new FileHandle(filePath.toString());
if (fileHandle.file().exists()) fileHandle.delete();
fileHandle.file().createNewFile();
Writer writer = new FileWriter(fileHandle.file());
FileUtils.createScene(writer,width,height,name);
writer.close();
return fileHandle;
}
示例3: ZipModInputStream
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
public ZipModInputStream(FileHandle file) {
try {
inputStream = new FileInputStream(file.file());
zipInputStream = new ZipInputStream(inputStream);
fileStream = new FilterInputStream(zipInputStream) {
@Override
public void close() throws IOException {
// no close
}
};
} catch (Exception e) {
try {
close();
} catch (IOException ignored) {
}
throw new CubesException("Failed to create zip mod input stream", e);
}
}
示例4: writeFile
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
public static void writeFile(Group group, FileHandle fileHandle) throws IOException {
FileWriter writer = new FileWriter(fileHandle.file());
XmlWriter xmlWriter= new XmlWriter(writer);
writeAttr(xmlWriter,group);
xmlWriter.flush();
writer.close();
}