當前位置: 首頁>>代碼示例>>Java>>正文


Java FileType.Local方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.Files.FileType.Local方法的典型用法代碼示例。如果您正苦於以下問題:Java FileType.Local方法的具體用法?Java FileType.Local怎麽用?Java FileType.Local使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.Files.FileType的用法示例。


在下文中一共展示了FileType.Local方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: read

import com.badlogic.gdx.Files.FileType; //導入方法依賴的package包/類
/** Returns a stream for reading this file as bytes.
 * @throws GdxRuntimeException if the file handle represents a directory, doesn't exist, or could not be read. */
public InputStream read () {
	if (type == FileType.Classpath || (type == FileType.Internal && !file().exists())
		|| (type == FileType.Local && !file().exists())) {
		InputStream input = FileHandle.class.getResourceAsStream("/" + file.getPath().replace('\\', '/'));
		if (input == null) throw new GdxRuntimeException("File not found: " + file + " (" + type + ")");
		return input;
	}
	try {
		return new FileInputStream(file());
	} catch (Exception ex) {
		if (file().isDirectory())
			throw new GdxRuntimeException("Cannot open a stream to a directory: " + file + " (" + type + ")", ex);
		throw new GdxRuntimeException("Error reading file: " + file + " (" + type + ")", ex);
	}
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:18,代碼來源:FileHandle.java

示例2: read

import com.badlogic.gdx.Files.FileType; //導入方法依賴的package包/類
/** Returns a stream for reading this file as bytes.
 * @throw GdxRuntimeException if the file handle represents a directory, doesn't exist, or could not be read. */
public InputStream read () {
	if (type == FileType.Classpath || (type == FileType.Internal && !file.exists())
		|| (type == FileType.Local && !file.exists())) {
		InputStream input = FileWrapper.class.getResourceAsStream("/" + file.getPath().replace('\\', '/'));
		if (input == null) throw new GdxRuntimeException("File not found: " + file + " (" + type + ")");
		return input;
	}
	try {
		return new FileInputStream(file());
	} catch (Exception ex) {
		if (file().isDirectory())
			throw new GdxRuntimeException("Cannot open a stream to a directory: " + file + " (" + type + ")", ex);
		throw new GdxRuntimeException("Error reading file: " + file + " (" + type + ")", ex);
	}
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:18,代碼來源:FileWrapper.java

示例3: start

import com.badlogic.gdx.Files.FileType; //導入方法依賴的package包/類
/**
 * @throws InitException If a fatal error occurs during initialization.
 */
public void start() throws InitException {
    DesktopGdxFileSystem gdxFileSystem = openResourceFileSystem(new File("."));
    IWritableFileSystem outputFileSystem = new DesktopOutputFileSystem(FileType.Local, "save/");

    final Launcher launcher = new Launcher(gdxFileSystem, outputFileSystem) {
        @Override
        public void create() {
            DesktopGraphicsUtil.setWindowIcon(gdxFileSystem);
            windowedSize = DesktopGraphicsUtil.limitInitialWindowSize(Gdx.graphics);

            super.create();
        }

        @Override
        public void resize(int width, int height) {
            super.resize(width, height);

            if (!Gdx.graphics.isFullscreen()) {
                windowedSize = Dim.of(width, height);
            }
        }

        @Override
        protected void handleInput(INativeInput input) {
            super.handleInput(input);

            DesktopLauncher.this.handleInput(input);
        }
    };

    NovelPrefsStore prefs = launcher.loadPreferences();
    handleCommandlineOptions(prefs);

    Lwjgl3ApplicationConfiguration config = createConfig(launcher, prefs);
    Lwjgl3Application app = new Lwjgl3Application(launcher, config);
    app.addLifecycleListener(new LifecycleListener() {
        @Override
        public void resume() {
            LOG.info("App resume");
        }

        @Override
        public void pause() {
            LOG.info("App pause");
        }

        @Override
        public void dispose() {
            LOG.info("App dispose");
        }
    });
}
 
開發者ID:anonl,項目名稱:nvlist,代碼行數:56,代碼來源:DesktopLauncher.java

示例4: file

import com.badlogic.gdx.Files.FileType; //導入方法依賴的package包/類
@Override
public File file () {
	if (type == FileType.Internal) return new File(IOSFiles.internalPath, file.getPath());
	if (type == FileType.External) return new File(IOSFiles.externalPath, file.getPath());
	if (type == FileType.Local) return new File(IOSFiles.localPath, file.getPath());
	return file;
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:8,代碼來源:IOSFileHandle.java

示例5: file

import com.badlogic.gdx.Files.FileType; //導入方法依賴的package包/類
public File file () {
    if (type == FileType.Local) return new File(Gdx.files.getLocalStoragePath(), file.getPath());
    return super.file();
}
 
開發者ID:Longri,項目名稱:cachebox3.0,代碼行數:5,代碼來源:LibgdxLoggerAndroidFileHandle.java

示例6: file

import com.badlogic.gdx.Files.FileType; //導入方法依賴的package包/類
@Override
public File file() {
    if (type == FileType.Internal) return new File(internalPath, file.getPath());
    if (type == FileType.External) return new File(externalPath, file.getPath());
    if (type == FileType.Local) return new File(localPath, file.getPath());
    return file;
}
 
開發者ID:Longri,項目名稱:cachebox3.0,代碼行數:8,代碼來源:LibgdxLoggerIosFileHandle.java

示例7: file

import com.badlogic.gdx.Files.FileType; //導入方法依賴的package包/類
public File file () {
	if (type == FileType.External) return new File(DesktopFileHandle.externalPath, file.getPath());
	if (type == FileType.Local) return new File(DesktopFileHandle.localPath, file.getPath());
	return file;
}
 
開發者ID:Mignet,項目名稱:Inspiration,代碼行數:6,代碼來源:StandaloneFileSystem.java

示例8: file

import com.badlogic.gdx.Files.FileType; //導入方法依賴的package包/類
public File file () {
	if (type == FileType.External) return new File(JglfwFiles.externalPath, file.getPath());
	if (type == FileType.Local) return new File(JglfwFiles.localPath, file.getPath());
	return file;
}
 
開發者ID:Arcnor,項目名稱:gdx-backend-jglfw,代碼行數:6,代碼來源:JglfwFileHandle.java

示例9: file

import com.badlogic.gdx.Files.FileType; //導入方法依賴的package包/類
public File file () {
	if (type == FileType.External) return new File(HeadlessFiles.externalPath, file.getPath());
	if (type == FileType.Local) return new File(HeadlessFiles.localPath, file.getPath());
	return file;
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:6,代碼來源:HeadlessFileHandle.java

示例10: file

import com.badlogic.gdx.Files.FileType; //導入方法依賴的package包/類
public File file () {
	if (type == FileType.External) return new File(LwjglFiles.externalPath, file.getPath());
	if (type == FileType.Local) return new File(LwjglFiles.localPath, file.getPath());
	return file;
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:6,代碼來源:LwjglFileHandle.java

示例11: file

import com.badlogic.gdx.Files.FileType; //導入方法依賴的package包/類
public File file () {
	if (type == FileType.Local) return new File(Gdx.files.getLocalStoragePath(), file.getPath());
	return super.file();
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:5,代碼來源:AndroidFileHandle.java


注:本文中的com.badlogic.gdx.Files.FileType.Local方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。