本文整理汇总了Java中net.minecraft.util.org.apache.commons.io.IOUtils.closeQuietly方法的典型用法代码示例。如果您正苦于以下问题:Java IOUtils.closeQuietly方法的具体用法?Java IOUtils.closeQuietly怎么用?Java IOUtils.closeQuietly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.org.apache.commons.io.IOUtils
的用法示例。
在下文中一共展示了IOUtils.closeQuietly方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
}
示例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);
}
}
示例3: 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;
}
示例4: 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);
}
}
示例5: 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());
}
}
}
}