/** * Returns the current working directory. * * @return a File for the current working directory. * * @since 1.7.1 */ public static File getCurrentWorkingDir() { return FileUtil.getCwd(); }
/** * Checks if testing is disabled. * @return true if testing is disabled; false is testing is enabled. */ public static boolean isTestingOff() { return !isTestingOn(); }
protected void initializeRound() { logMessage(""); logMessage("Let the games begin!"); roundOver = false; endTimer = 0; currentTime = 0; }
private boolean loadProperties() { if (itemUrl != null) { InputStream ios = null; try { final URLConnection connection = URLJarCollector.openConnection(itemUrl); ios = connection.getInputStream(); properties.load(ios); return true; } catch (IOException e) { Logger.logError(e); } finally { FileUtil.cleanupStream(ios); } } return false; }
public static void logError(String message, Throwable t) { logError(message + ":\n" + toStackTraceString(t)); }
public File getReadableDirectory() { try { return (readableRootDirectory == null) ? null : new File(readableRootDirectory).getCanonicalFile(); } catch (IOException e) { Logger.logError(e); return null; } }
private boolean isInvalidURL(URL url) { if (url != null) { InputStream is = null; try { URLConnection conn = URLJarCollector.openConnection(url); is = conn.getInputStream(); return false; } catch (IOException e) { return true; } finally { FileUtil.cleanupStream(is); } } return true; }
/** * Returns the directory containing the robots. * * @return a File for the robot directory containing all robots. * * @since 1.7.1 */ public static File getRobotsDir() { return FileUtil.getRobotsDir(); }
void cleanupStreams() { FileUtil.cleanupStream(objectWriteStream); objectWriteStream = null; FileUtil.cleanupStream(bufferedWriteStream); bufferedWriteStream = null; FileUtil.cleanupStream(fileWriteStream); fileWriteStream = null; FileUtil.cleanupStream(objectReadStream); objectReadStream = null; FileUtil.cleanupStream(bufferedReadStream); bufferedReadStream = null; FileUtil.cleanupStream(fileReadStream); fileReadStream = null; }
/** * Returns the directory containing the configuration files. * If the directory does not exist, it will be created automatically. * * @return a File that is the directory containing configuration files */ public static File getConfigDir() { return createDir(new File(cwd, "/config")); }
private void notSupportedWarn() { Logger.printlnToRobotsConsole("SYSTEM: We are sorry. Operation is not supported in Robocode."); }
public boolean isDebugging() { return RobocodeProperties.isDebuggingOn(); }
private JarJarURLConnection(URL url) throws IOException { super(url); final String file = url.getFile(); URL inner = new URL(file); // this is same as // connection = inner.openConnection() // we just cache the connection in URLJarCollector // because we need to be able to close it to release jar files connection = URLJarCollector.openConnection(inner); }
protected void preloadRound() { logMessage("----------------------"); Logger.logMessage("Round " + (roundNum + 1) + " initializing..", false); }
public static void logError(Throwable t) { logError(toStackTraceString(t)); }
@Override public File getRobotsDirectory() { return FileUtil.getRobotsDir(); }
/** * Returns the directory containing the screen shot files. * If the directory does not exist, it will be created automatically. * * @return a File that is the directory containing screen shot files */ public static File getScreenshotsDir() { return createDir(new File(cwd, "/screenshots")); }
public static void logWarning(String s) { logMessage("Warning: " + s, true); }
private void cleanupRound() { logMessage("Round " + (roundNum + 1) + " cleaning up."); }
public static void logMessage(String s) { logMessage(s, true); }