本文整理汇总了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();
}
示例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();
}
示例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);
//--------------------------------------------------------------------
}
示例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();
}
示例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();
}
示例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;
}
}
}
示例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!");
}
}
示例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();
}
示例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();
}
示例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();
}
示例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.");
}
}
示例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!");
}
}