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


Java ImageIO.setUseCache方法代碼示例

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


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

示例1: Minecraft

import javax.imageio.ImageIO; //導入方法依賴的package包/類
public Minecraft(GameConfiguration gameConfig)
{
    theMinecraft = this;
    this.mcDataDir = gameConfig.folderInfo.mcDataDir;
    this.fileAssets = gameConfig.folderInfo.assetsDir;
    this.fileResourcepacks = gameConfig.folderInfo.resourcePacksDir;
    this.launchedVersion = gameConfig.gameInfo.version;
    this.twitchDetails = gameConfig.userInfo.userProperties;
    this.field_181038_N = gameConfig.userInfo.field_181172_c;
    this.mcDefaultResourcePack = new DefaultResourcePack((new ResourceIndex(gameConfig.folderInfo.assetsDir, gameConfig.folderInfo.assetIndex)).getResourceMap());
    this.proxy = gameConfig.userInfo.proxy == null ? Proxy.NO_PROXY : gameConfig.userInfo.proxy;
    this.sessionService = (new YggdrasilAuthenticationService(gameConfig.userInfo.proxy, UUID.randomUUID().toString())).createMinecraftSessionService();
    this.session = gameConfig.userInfo.session;
    logger.info("Setting user: " + this.session.getUsername());
    logger.info("(Session ID is " + this.session.getSessionID() + ")");
    this.isDemo = gameConfig.gameInfo.isDemo;
    this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1;
    this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1;
    this.tempDisplayWidth = gameConfig.displayInfo.width;
    this.tempDisplayHeight = gameConfig.displayInfo.height;
    this.fullscreen = gameConfig.displayInfo.fullscreen;
    this.jvm64bit = isJvm64bit();
    this.theIntegratedServer = new IntegratedServer(this);

    if (gameConfig.serverInfo.serverName != null)
    {
        this.serverName = gameConfig.serverInfo.serverName;
        this.serverPort = gameConfig.serverInfo.serverPort;
    }

    ImageIO.setUseCache(false);
    Bootstrap.register();
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:34,代碼來源:Minecraft.java

示例2: Minecraft

import javax.imageio.ImageIO; //導入方法依賴的package包/類
public Minecraft(GameConfiguration gameConfig) {
	theMinecraft = this;
	this.mcDataDir = gameConfig.folderInfo.mcDataDir;
	this.fileAssets = gameConfig.folderInfo.assetsDir;
	this.fileResourcepacks = gameConfig.folderInfo.resourcePacksDir;
	this.launchedVersion = gameConfig.gameInfo.version;
	this.twitchDetails = gameConfig.userInfo.userProperties;
	this.field_181038_N = gameConfig.userInfo.field_181172_c;
	this.mcDefaultResourcePack = new DefaultResourcePack(
			(new ResourceIndex(gameConfig.folderInfo.assetsDir, gameConfig.folderInfo.assetIndex))
					.getResourceMap());
	this.proxy = gameConfig.userInfo.proxy == null ? Proxy.NO_PROXY : gameConfig.userInfo.proxy;
	this.sessionService = (new YggdrasilAuthenticationService(gameConfig.userInfo.proxy,
			UUID.randomUUID().toString())).createMinecraftSessionService();
	this.session = gameConfig.userInfo.session;
	logger.info("Setting user: " + this.session.getUsername());
	logger.info("(Session ID is " + this.session.getSessionID() + ")");
	this.isDemo = gameConfig.gameInfo.isDemo;
	this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1;
	this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1;
	this.tempDisplayWidth = gameConfig.displayInfo.width;
	this.tempDisplayHeight = gameConfig.displayInfo.height;
	this.fullscreen = gameConfig.displayInfo.fullscreen;
	this.jvm64bit = isJvm64bit();
	this.theIntegratedServer = new IntegratedServer(this);

	if (gameConfig.serverInfo.serverName != null) {
		this.serverName = gameConfig.serverInfo.serverName;
		this.serverPort = gameConfig.serverInfo.serverPort;
	}

	ImageIO.setUseCache(false);
	Bootstrap.register();
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:35,代碼來源:Minecraft.java

示例3: Minecraft

import javax.imageio.ImageIO; //導入方法依賴的package包/類
public Minecraft(GameConfiguration gameConfig)
{
    theMinecraft = this;
    this.mcDataDir = gameConfig.folderInfo.mcDataDir;
    this.fileAssets = gameConfig.folderInfo.assetsDir;
    this.fileResourcepacks = gameConfig.folderInfo.resourcePacksDir;
    this.launchedVersion = gameConfig.gameInfo.version;
    this.versionType = gameConfig.gameInfo.versionType;
    this.twitchDetails = gameConfig.userInfo.userProperties;
    this.profileProperties = gameConfig.userInfo.profileProperties;
    this.mcDefaultResourcePack = new DefaultResourcePack(gameConfig.folderInfo.getAssetsIndex());
    this.proxy = gameConfig.userInfo.proxy == null ? Proxy.NO_PROXY : gameConfig.userInfo.proxy;
    this.sessionService = (new YggdrasilAuthenticationService(this.proxy, UUID.randomUUID().toString())).createMinecraftSessionService();
    this.session = gameConfig.userInfo.session;
    LOGGER.info("Setting user: {}", new Object[] {this.session.getUsername()});
    LOGGER.debug("(Session ID is {})", new Object[] {this.session.getSessionID()});
    this.isDemo = gameConfig.gameInfo.isDemo;
    this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1;
    this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1;
    this.tempDisplayWidth = gameConfig.displayInfo.width;
    this.tempDisplayHeight = gameConfig.displayInfo.height;
    this.fullscreen = gameConfig.displayInfo.fullscreen;
    this.jvm64bit = isJvm64bit();
    this.theIntegratedServer = null;

    if (gameConfig.serverInfo.serverName != null)
    {
        this.serverName = gameConfig.serverInfo.serverName;
        this.serverPort = gameConfig.serverInfo.serverPort;
    }

    ImageIO.setUseCache(false);
    Bootstrap.register();
    this.dataFixer = DataFixesManager.createFixer();
    
    //-ZMod-core----------------------------------------------------------
    ZHandle.onMinecraftInit(this);
    //--------------------------------------------------------------------
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:40,代碼來源:Minecraft.java

示例4: Context

import javax.imageio.ImageIO; //導入方法依賴的package包/類
Context(TestEnvironment env, Result result) {
    size = env.getIntValue(sizeList);
    if (hasImageIO) {
        if (env.getModifier(useCacheTog) != null) {
            ImageIO.setUseCache(env.isEnabled(useCacheTog));
        }
    }

    InputType t = (InputType)env.getModifier(generalSourceRoot);
    inputType = t.getType();
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:12,代碼來源:InputTests.java

示例5: Context

import javax.imageio.ImageIO; //導入方法依賴的package包/類
Context(TestEnvironment env, Result result) {
    size = env.getIntValue(sizeList);
    if (hasImageIO) {
        if (env.getModifier(useCacheTog) != null) {
            ImageIO.setUseCache(env.isEnabled(useCacheTog));
        }
    }

    OutputType t = (OutputType)env.getModifier(generalDestRoot);
    outputType = t.getType();
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:12,代碼來源:OutputTests.java

示例6: run

import javax.imageio.ImageIO; //導入方法依賴的package包/類
public void run() {
//          System.out.println("Thread " + threadName + " in thread group " +
//                             getThreadGroup().getName());

        // Create a new AppContext as though we were an applet
        SunToolkit.createNewAppContext();

        // Get default registry and store reference
        this.registry = IIORegistry.getDefaultInstance();

        for (int i = 0; i < 10; i++) {
//              System.out.println(threadName +
//                                 ": setting cache parameters to " +
//                                 useCache + ", " + cacheDirectory);
            ImageIO.setUseCache(useCache);
            ImageIO.setCacheDirectory(cacheDirectory);

            try {
                sleep(1000L);
            } catch (InterruptedException e) {
            }

//              System.out.println(threadName + ": reading cache parameters");
            boolean newUseCache = ImageIO.getUseCache();
            File newCacheDirectory = ImageIO.getCacheDirectory();
            if (newUseCache != useCache ||
                newCacheDirectory != cacheDirectory) {
//                  System.out.println(threadName + ": got " +
//                                     newUseCache + ", " +
//                                     newCacheDirectory);
//                  System.out.println(threadName + ": crosstalk encountered!");
                gotCrosstalk = true;
            }
        }
    }
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:36,代碼來源:AppContextTest.java

示例7: main

import javax.imageio.ImageIO; //導入方法依賴的package包/類
public static void main(String[] args) {
    ImageIO.setUseCache(false);
    OutputStream os = new ByteArrayOutputStream();
    ImageOutputStream stream = null;
    try {
        stream = ImageIO.createImageOutputStream(os);
    } catch (Exception e) {
        throw new RuntimeException("Got exception " + e);
    }
    if (stream == null) {
        throw new RuntimeException("Got null stream!");
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:14,代碼來源:CreateMemoryCacheOutputStream.java

示例8: MeviusImagePacket

import javax.imageio.ImageIO; //導入方法依賴的package包/類
public MeviusImagePacket(BufferedImage image) throws IOException, ClassNotFoundException {
	ByteArrayOutputStream baos = new ByteArrayOutputStream(image.getHeight() * image.getWidth());
	ImageIO.setUseCache(false);
	ImageIO.write(image, "jpg", baos);
	imageBuffer = baos.toByteArray();
	baos.flush();
	baos.close();
}
 
開發者ID:biancso,項目名稱:Mevius-IO,代碼行數:9,代碼來源:MeviusImagePacket.java

示例9: Minecraft

import javax.imageio.ImageIO; //導入方法依賴的package包/類
public Minecraft(GameConfiguration gameConfig)
{
    theMinecraft = this;
    this.mcDataDir = gameConfig.folderInfo.mcDataDir;
    this.fileAssets = gameConfig.folderInfo.assetsDir;
    this.fileResourcepacks = gameConfig.folderInfo.resourcePacksDir;
    this.launchedVersion = gameConfig.gameInfo.version;
    this.versionType = gameConfig.gameInfo.versionType;
    this.twitchDetails = gameConfig.userInfo.userProperties;
    this.profileProperties = gameConfig.userInfo.profileProperties;
    this.mcDefaultResourcePack = new DefaultResourcePack(gameConfig.folderInfo.getAssetsIndex());
    this.proxy = gameConfig.userInfo.proxy == null ? Proxy.NO_PROXY : gameConfig.userInfo.proxy;
    this.sessionService = (new YggdrasilAuthenticationService(this.proxy, UUID.randomUUID().toString())).createMinecraftSessionService();
    this.session = gameConfig.userInfo.session;
    LOGGER.info("Setting user: {}", new Object[] {this.session.getUsername()});
    LOGGER.debug("(Session ID is {})", new Object[] {this.session.getSessionID()});
    this.isDemo = gameConfig.gameInfo.isDemo;
    this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1;
    this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1;
    this.tempDisplayWidth = gameConfig.displayInfo.width;
    this.tempDisplayHeight = gameConfig.displayInfo.height;
    this.fullscreen = gameConfig.displayInfo.fullscreen;
    this.jvm64bit = isJvm64bit();
    this.theIntegratedServer = null;

    if (gameConfig.serverInfo.serverName != null)
    {
        this.serverName = gameConfig.serverInfo.serverName;
        this.serverPort = gameConfig.serverInfo.serverPort;
    }

    ImageIO.setUseCache(false);
    Locale.setDefault(Locale.ROOT);
    Bootstrap.register();
    this.dataFixer = DataFixesManager.createFixer();
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:37,代碼來源:Minecraft.java

示例10: Minecraft

import javax.imageio.ImageIO; //導入方法依賴的package包/類
public Minecraft(GameConfiguration gameConfig)
{
    theMinecraft = this;
    this.mcDataDir = gameConfig.folderInfo.mcDataDir;
    this.fileAssets = gameConfig.folderInfo.assetsDir;
    this.fileResourcepacks = gameConfig.folderInfo.resourcePacksDir;
    this.launchedVersion = gameConfig.gameInfo.version;
    this.versionType = gameConfig.gameInfo.versionType;
    this.twitchDetails = gameConfig.userInfo.userProperties;
    this.profileProperties = gameConfig.userInfo.profileProperties;
    this.mcDefaultResourcePack = new DefaultResourcePack(gameConfig.folderInfo.getAssetsIndex());
    this.proxy = gameConfig.userInfo.proxy == null ? Proxy.NO_PROXY : gameConfig.userInfo.proxy;
    this.sessionService = (new YggdrasilAuthenticationService(this.proxy, UUID.randomUUID().toString())).createMinecraftSessionService();
    this.session = gameConfig.userInfo.session;
    LOGGER.info("Setting user: {}", new Object[] {this.session.getUsername()});
    this.isDemo = gameConfig.gameInfo.isDemo;
    this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1;
    this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1;
    this.tempDisplayWidth = gameConfig.displayInfo.width;
    this.tempDisplayHeight = gameConfig.displayInfo.height;
    this.fullscreen = gameConfig.displayInfo.fullscreen;
    this.jvm64bit = isJvm64bit();
    this.theIntegratedServer = null;

    if (gameConfig.serverInfo.serverName != null)
    {
        this.serverName = gameConfig.serverInfo.serverName;
        this.serverPort = gameConfig.serverInfo.serverPort;
    }

    ImageIO.setUseCache(false);
    Bootstrap.register();
    this.dataFixer = DataFixesManager.createFixer();
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:35,代碼來源:Minecraft.java

示例11: main

import javax.imageio.ImageIO; //導入方法依賴的package包/類
public static void main(String[] args) throws IOException {
    ByteArrayInputStream is =
        new ByteArrayInputStream(new byte[100]);
    ByteArrayOutputStream os =
        new ByteArrayOutputStream();

    String tmp = System.getProperty("java.io.tmpdir", ".");
    System.out.println("tmp: " + tmp);

    // count number of files before test
    ImageIO.setUseCache(true);
    ImageIO.setCacheDirectory(new File(tmp));

    File tmpDir = ImageIO.getCacheDirectory();
    System.out.println("tmpDir is " + tmpDir);
    int fnum_before = tmpDir.list().length;
    System.out.println("Files before test: " + fnum_before);

    ImageInputStream iis =
        ImageIO.createImageInputStream(is);
    System.out.println("iis = " + iis);

    ImageInputStream iis2 =
        ImageIO.createImageInputStream(is);

    ImageOutputStream ios =
        ImageIO.createImageOutputStream(os);
    System.out.println("ios = " + ios);

    ImageOutputStream ios2 =
        ImageIO.createImageOutputStream(os);

    iis2.close();
    ios2.close();
    int fnum_after = tmpDir.list().length;
    System.out.println("Files after test: " + fnum_after);

    if (fnum_before == fnum_after) {
        throw new RuntimeException("Test failed: cache was not used.");
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:42,代碼來源:DeleteOnExitTest.java

示例12: main

import javax.imageio.ImageIO; //導入方法依賴的package包/類
public static void main(String[] args) throws IOException {
    ImageIO.setUseCache(true);

    // Create a FileImageOutputStream from a FileOutputStream
    File temp1 = File.createTempFile("imageio", ".tmp");
    temp1.deleteOnExit();
    ImageOutputStream fios = ImageIO.createImageOutputStream(temp1);

    // Create a FileCacheImageOutputStream from a BufferedOutputStream
    File temp2 = File.createTempFile("imageio", ".tmp");
    temp2.deleteOnExit();
    FileOutputStream fos2 = new FileOutputStream(temp2);
    BufferedOutputStream bos = new BufferedOutputStream(fos2);
    ImageOutputStream fcios1 = ImageIO.createImageOutputStream(bos);

    // Create a FileCacheImageOutputStream from a ByteArrayOutputStream
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ImageOutputStream fcios2 = ImageIO.createImageOutputStream(baos);

    BufferedImage bi =
        new BufferedImage(10, 10, BufferedImage.TYPE_3BYTE_BGR);

    ImageIO.write(bi, "jpg", fios); // No bug, check it anyway
    ImageIO.write(bi, "png", fcios1); // Bug 4414990
    ImageIO.write(bi, "jpg", fcios2); // Bug 4415041

    // It should not be necessary to flush any of the streams
    // If flushing does make a difference, it indicates a bug
    // in the writer or the stream implementation

    // Get length of temp1 before and after flushing
    long file1NoFlushLength = temp1.length();
    fios.flush();
    long file1FlushLength = temp1.length();

    // Get length of temp2 before and after flushing
    long file2NoFlushLength = temp2.length();
    fcios1.flush();
    bos.flush();
    long file2FlushLength = temp2.length();

    byte[] b0 = baos.toByteArray();
    int cacheNoFlushLength = b0.length;
    fcios2.flush();
    byte[] b1 = baos.toByteArray();
    int cacheFlushLength = b1.length;

    if (file1NoFlushLength != file1FlushLength) {
        // throw new RuntimeException
        System.out.println
            ("FileImageOutputStream not flushed!");
    }

    if (file2NoFlushLength != file2FlushLength) {
        // throw new RuntimeException
        System.out.println
         ("FileCacheImageOutputStream/BufferedOutputStream not flushed!");
    }

    if (cacheNoFlushLength != cacheFlushLength) {
        // throw new RuntimeException
        System.out.println
        ("FileCacheImageOutputStream/ByteArrayOutputStream not flushed!");
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:66,代碼來源:StreamFlush.java


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