当前位置: 首页>>代码示例>>Java>>正文


Java IOUtils类代码示例

本文整理汇总了Java中net.minecraft.util.org.apache.commons.io.IOUtils的典型用法代码示例。如果您正苦于以下问题:Java IOUtils类的具体用法?Java IOUtils怎么用?Java IOUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IOUtils类属于net.minecraft.util.org.apache.commons.io包,在下文中一共展示了IOUtils类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: load

import net.minecraft.util.org.apache.commons.io.IOUtils; //导入依赖的package包/类
public void load() throws IOException { // CraftBukkit - Added throws
    Collection collection = null;
    BufferedReader bufferedreader = null;

    try {
        bufferedreader = Files.newReader(this.c, Charsets.UTF_8);
        collection = (Collection) this.b.fromJson(bufferedreader, f);
    } finally {
        IOUtils.closeQuietly(bufferedreader);
    }

    if (collection != null) {
        this.d.clear();
        Iterator iterator = collection.iterator();

        while (iterator.hasNext()) {
            JsonListEntry jsonlistentry = (JsonListEntry) iterator.next();

            if (jsonlistentry.getKey() != null) {
                this.d.put(this.a(jsonlistentry.getKey()), jsonlistentry);
            }
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:25,代码来源:JsonList.java

示例2: c

import net.minecraft.util.org.apache.commons.io.IOUtils; //导入依赖的package包/类
public void c() {
    String s = this.b.toJson(this.a(org.spigotmc.SpigotConfig.userCacheCap));
    BufferedWriter bufferedwriter = null;

    try {
        bufferedwriter = Files.newWriter(this.g, Charsets.UTF_8);
        bufferedwriter.write(s);
        return;
    } catch (FileNotFoundException filenotfoundexception) {
        return;
    } catch (IOException ioexception) {
        ;
    } finally {
        IOUtils.closeQuietly(bufferedwriter);
    }
}
 
开发者ID:pvginkel,项目名称:Tweakkit-Server,代码行数:17,代码来源:UserCache.java

示例3: loadLanguageStrings

import net.minecraft.util.org.apache.commons.io.IOUtils; //导入依赖的package包/类
private void loadLanguageStrings() {
    File languageFile = new File(plugin.getDataFolder(), "language.yml");
    InputStream resource = plugin.getResource("language.yml");

    if (!languageFile.exists()) {
        try {
            IOUtils.copy(resource, new FileOutputStream(languageFile));
        } catch (Exception e) {
            plugin.getLogger()
                    .warning("Default language file could not be written, unexpected results may appear!");
            e.printStackTrace();
        }
    }

    language = YamlConfiguration.loadConfiguration(languageFile);
    language.setDefaults(YamlConfiguration.loadConfiguration(resource));
}
 
开发者ID:ase34,项目名称:itemtrader,代码行数:18,代码来源:LanguageStrings.java

示例4: d

import net.minecraft.util.org.apache.commons.io.IOUtils; //导入依赖的package包/类
public String d() {
    StringWriter stringwriter = null;
    PrintWriter printwriter = null;
    Object object = this.c;

    if (((Throwable) object).getMessage() == null) {
        if (object instanceof NullPointerException) {
            object = new NullPointerException(this.b);
        } else if (object instanceof StackOverflowError) {
            object = new StackOverflowError(this.b);
        } else if (object instanceof OutOfMemoryError) {
            object = new OutOfMemoryError(this.b);
        }

        ((Throwable) object).setStackTrace(this.c.getStackTrace());
    }

    String s = ((Throwable) object).toString();

    try {
        stringwriter = new StringWriter();
        printwriter = new PrintWriter(stringwriter);
        ((Throwable) object).printStackTrace(printwriter);
        s = stringwriter.toString();
    } finally {
        IOUtils.closeQuietly(stringwriter);
        IOUtils.closeQuietly(printwriter);
    }

    return s;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:32,代码来源:CrashReport.java

示例5: save

import net.minecraft.util.org.apache.commons.io.IOUtils; //导入依赖的package包/类
public void save() throws IOException { // CraftBukkit - Added throws
    Collection collection = this.d.values();
    String s = this.b.toJson(collection);
    BufferedWriter bufferedwriter = null;

    try {
        bufferedwriter = Files.newWriter(this.c, Charsets.UTF_8);
        bufferedwriter.write(s);
    } finally {
        IOUtils.closeQuietly(bufferedwriter);
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:13,代码来源:JsonList.java

示例6: b

import net.minecraft.util.org.apache.commons.io.IOUtils; //导入依赖的package包/类
public void b() {
    List list = null;
    BufferedReader bufferedreader = null;

    label81: {
        try {
            bufferedreader = Files.newReader(this.g, Charsets.UTF_8);
            list = (List) this.b.fromJson(bufferedreader, h);
            break label81;
        } catch (FileNotFoundException filenotfoundexception) {
            ;
        // Spigot Start
        } catch (net.minecraft.util.com.google.gson.JsonSyntaxException ex) {
            JsonList.a.warn( "Usercache.json is corrupted or has bad formatting. Deleting it to prevent further issues." );
            this.g.delete();
        // Spigot End
        } finally {
            IOUtils.closeQuietly(bufferedreader);
        }

        return;
    }

    if (list != null) {
        this.c.clear();
        this.d.clear();
        LinkedList linkedlist = this.e;

        synchronized (this.e) {
            this.e.clear();
        }

        list = Lists.reverse(list);
        Iterator iterator = list.iterator();

        while (iterator.hasNext()) {
            UserCacheEntry usercacheentry = (UserCacheEntry) iterator.next();

            if (usercacheentry != null) {
                this.a(usercacheentry.a(), usercacheentry.b());
            }
        }
    }
}
 
开发者ID:pvginkel,项目名称:Tweakkit-Server,代码行数:45,代码来源:UserCache.java


注:本文中的net.minecraft.util.org.apache.commons.io.IOUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。