本文整理汇总了Java中net.minecraft.logging.ILogAgent.logSevereException方法的典型用法代码示例。如果您正苦于以下问题:Java ILogAgent.logSevereException方法的具体用法?Java ILogAgent.logSevereException怎么用?Java ILogAgent.logSevereException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.logging.ILogAgent
的用法示例。
在下文中一共展示了ILogAgent.logSevereException方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveToFile
import net.minecraft.logging.ILogAgent; //导入方法依赖的package包/类
/**
* Saves the complete crash report to the given File.
*/
public boolean saveToFile(File par1File, ILogAgent par2ILogAgent)
{
if (this.crashReportFile != null)
{
return false;
}
else
{
if (par1File.getParentFile() != null)
{
par1File.getParentFile().mkdirs();
}
try
{
FileWriter filewriter = new FileWriter(par1File);
filewriter.write(this.getCompleteReport());
filewriter.close();
this.crashReportFile = par1File;
return true;
}
catch (Throwable throwable)
{
par2ILogAgent.logSevereException("Could not save crash report to " + par1File, throwable);
return false;
}
}
}
示例2: sendPost
import net.minecraft.logging.ILogAgent; //导入方法依赖的package包/类
/**
* Sends a HTTP POST request to the given URL with data from a string
*/
private static String sendPost(ILogAgent par0ILogAgent, URL par1URL, String par2Str, boolean par3)
{
try
{
Proxy proxy = MinecraftServer.getServer() == null ? null : MinecraftServer.getServer().getServerProxy();
if (proxy == null)
{
proxy = Proxy.NO_PROXY;
}
HttpURLConnection httpurlconnection = (HttpURLConnection)par1URL.openConnection(proxy);
httpurlconnection.setRequestMethod("POST");
httpurlconnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
httpurlconnection.setRequestProperty("Content-Length", "" + par2Str.getBytes().length);
httpurlconnection.setRequestProperty("Content-Language", "en-US");
httpurlconnection.setUseCaches(false);
httpurlconnection.setDoInput(true);
httpurlconnection.setDoOutput(true);
DataOutputStream dataoutputstream = new DataOutputStream(httpurlconnection.getOutputStream());
dataoutputstream.writeBytes(par2Str);
dataoutputstream.flush();
dataoutputstream.close();
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(httpurlconnection.getInputStream()));
StringBuffer stringbuffer = new StringBuffer();
String s1;
while ((s1 = bufferedreader.readLine()) != null)
{
stringbuffer.append(s1);
stringbuffer.append('\r');
}
bufferedreader.close();
return stringbuffer.toString();
}
catch (Exception exception)
{
if (!par3)
{
if (par0ILogAgent != null)
{
par0ILogAgent.logSevereException("Could not post to " + par1URL, exception);
}
else
{
Logger.getAnonymousLogger().log(Level.SEVERE, "Could not post to " + par1URL, exception);
}
}
return "";
}
}