/** * Resets the current thread's context loader to its original value. */ public void resetThreadContextLoader() { if (LoaderUtils.isContextLoaderAvailable() && isContextLoaderSaved) { LoaderUtils.setContextClassLoader(savedContextLoader); savedContextLoader = null; isContextLoaderSaved = false; } }
/** * Classpath to be used when searching for classes and resources. * * @return an empty Path instance to be configured by Ant. */ public Path createClasspath() { return getClassPathDelegate().createClasspath(); }
/** * Set the classpath to be used when searching for classes and resources. * * @param classpath an Ant Path object containing the search path. */ public void setClasspath(Path classpath) { getClassPathDelegate().setClasspath(classpath); }
private File getClassSource(ClassLoader loader, String className) { return LoaderUtils.getResourceSource( loader, LoaderUtils.classNameToResource(className)); }
/** * Finds or creates the classloader for this object. * @return The class loader. */ public ClassLoader getClassLoader() { return getClassLoaderForPath(getContextProject(), classpath, getClassLoadId(), reverseLoader, loaderId != null || isMagicPropertySet(getContextProject())); }
/** * Helper method obtaining a fresh instance of the class specified * in the @classname and using the specified classpath. * * @return the fresh instantiated object. */ public Object newInstance() { return ClasspathUtils.newInstance(this.className, getClassLoader()); }
/** * Accommodate Windows bug encountered in both Sun and IBM JDKs. * Others possible. If the delete does not work, call System.gc(), * wait a little and try again. * * @param f File * @return whether deletion was successful * @since Ant 1.8.0 */ public boolean tryHardToDelete(File f) { return tryHardToDelete(f, ON_WINDOWS); }
/** * Set the classpath by reference. * * @param r a Reference to a Path instance to be used as the classpath * value. */ public void setClasspathRef(Reference r) { getClassPathDelegate().setClasspathref(r); }
/** * Run the script using the helper object. * * @exception BuildException if something goes wrong with the build */ public void execute() throws BuildException { helper.getScriptRunner().executeScript("ANT"); }
@Override public synchronized boolean addAll(Collection<? extends E> c) { boolean changed = false; for (E e : c) { changed |= add(e); } return changed; }
/** * Safe read fully - do not return a null for an empty reader. * @param reader the input to read from. * @return the string. * @throws IOException if unable to read from reader. * @since Ant 1.7.1 */ public static String safeReadFully(Reader reader) throws IOException { String ret = readFully(reader); return ret == null ? "" : ret; }
/** * Escape <, >, &, ', " as their entities and * drop characters that are illegal in XML documents. * @param value the string to encode. * @return the encoded string. */ public String encode(String value) { return encode(value, false); }
/** * Return <code>true</code> if this <code>DeweyDecimal</code> is * less than the other <code>DeweyDecimal</code>. * * @param other the other DeweyDecimal * @return true if less than other DeweyDecimal, false otherwise */ public boolean isLessThan(final DeweyDecimal other) { return !isGreaterThanOrEqual(other); }
/** * Delegates to {@link #contains contains}. * @param value the value to look for. * @return true if the table contains the value. */ public boolean containsValue(Object value) { return contains(value); }
/** * Construct a new <code>LeadPipeInputStream</code> to pull * from the specified <code>PipedOutputStream</code>, using a * circular buffer of the specified size. * @param src the <code>PipedOutputStream</code> source. * @param size the size of the circular buffer. * @throws IOException if there is an error. */ public LeadPipeInputStream(PipedOutputStream src, int size) throws IOException { super(src); setBufferSize(size); }
/** * Return the unicode escape sequence for a character, in the form * \u005CuNNNN. * @param ch the character to encode * @return the unicode escape sequence */ private String escapeUnicode(final char ch) { return "\\" + UnicodeUtil.EscapeUnicode(ch); }
/** * Loads the script from an external file; optional. * * @param file the file containing the script source. */ public void setSrc(File file) { helper.setSrc(file); }
/** * Convenience factory method that returns a non-closing * PrintStream around System.out. * * @return PrintStream * @since Ant 1.8.0 */ public static PrintStream wrapSystemOut() { return wrap(System.out); }
/** * Resets the current thread's context loader to its original value. */ public void resetThreadContextLoader() { if (LoaderUtils.isContextLoaderAvailable() && isContextLoaderSaved) { LoaderUtils.setContextClassLoader(savedContextLoader); savedContextLoader = null; isContextLoaderSaved = false; } }
/** * Escape <, >, &, ', " as their entities, \n, * \r and \t as numeric entities and drop characters that are * illegal in XML documents. * @param value the string to encode. * @return the encoded string. */ public String encodeAttributeValue(String value) { return encode(value, true); }