use of processing.data.StringList in project processing by processing.
the class Base method getInstalledContribsInfo.
public byte[] getInstalledContribsInfo() {
List<Contribution> contribs = getInstalledContribs();
StringList entries = new StringList();
for (Contribution c : contribs) {
String entry = c.getTypeName() + "=" + PApplet.urlEncode(String.format("name=%s\nurl=%s\nrevision=%d\nversion=%s", c.getName(), c.getUrl(), c.getVersion(), c.getBenignVersion()));
entries.append(entry);
}
String joined = "id=" + UpdateCheck.getUpdateID() + "&" + entries.join("&");
// return sb.toString();
return joined.getBytes();
}
use of processing.data.StringList in project processing by processing.
the class Util method listFiles.
public static String[] listFiles(File folder, boolean relative, String extension) {
if (extension != null) {
if (!extension.startsWith(".")) {
extension = "." + extension;
}
}
StringList list = new StringList();
listFilesImpl(folder, relative, extension, list);
if (relative) {
String[] outgoing = new String[list.size()];
// remove the slash (or backslash) as well
int prefixLength = folder.getAbsolutePath().length() + 1;
for (int i = 0; i < outgoing.length; i++) {
outgoing[i] = list.get(i).substring(prefixLength);
}
return outgoing;
}
return list.array();
}
use of processing.data.StringList in project processing by processing.
the class Util method packageListFromClassPath.
/**
* A classpath, separated by the path separator, will contain
* a series of .jar/.zip files or directories containing .class
* files, or containing subdirectories that have .class files.
*
* @param path the input classpath
* @return array of possible package names
*/
public static StringList packageListFromClassPath(String path) {
// Map<String, Object> map = new HashMap<String, Object>();
StringList list = new StringList();
String[] pieces = PApplet.split(path, File.pathSeparatorChar);
for (int i = 0; i < pieces.length; i++) {
//System.out.println("checking piece '" + pieces[i] + "'");
if (pieces[i].length() == 0)
continue;
if (pieces[i].toLowerCase().endsWith(".jar") || pieces[i].toLowerCase().endsWith(".zip")) {
//System.out.println("checking " + pieces[i]);
packageListFromZip(pieces[i], list);
} else {
// it's another type of file or directory
File dir = new File(pieces[i]);
if (dir.exists() && dir.isDirectory()) {
packageListFromFolder(dir, null, list);
//importCount = magicImportsRecursive(dir, null,
// map);
//imports, importCount);
}
}
}
// int mapCount = map.size();
// String output[] = new String[mapCount];
// int index = 0;
// Set<String> set = map.keySet();
// for (String s : set) {
// output[index++] = s.replace('/', '.');
// }
// return output;
StringList outgoing = new StringList(list.size());
for (String item : list) {
outgoing.append(item.replace('/', '.'));
}
return outgoing;
}
use of processing.data.StringList in project processing by processing.
the class Contribution method parseModeList.
/**
* Helper function that creates a StringList of the compatible Modes
* for this Contribution.
*/
static StringList parseModeList(StringDict properties) {
String unparsedModes = properties.get(MODES_PROPERTY);
// Workaround for 3.0 alpha/beta bug for 3.0b2
if ("null".equals(unparsedModes)) {
properties.remove(MODES_PROPERTY);
unparsedModes = null;
}
StringList outgoing = new StringList();
if (unparsedModes != null) {
outgoing.append(PApplet.trim(PApplet.split(unparsedModes, ',')));
}
return outgoing;
}
use of processing.data.StringList in project processing by processing.
the class Contribution method parseImports.
/**
* Returns the list of imports specified by this library author. Only
* necessary for library authors that want to override the default behavior
* of importing all packages in their library.
* @return null if no entries found
*/
static StringList parseImports(StringDict properties) {
StringList outgoing = new StringList();
String importStr = properties.get(IMPORTS_PROPERTY);
if (importStr != null) {
String[] importList = PApplet.trim(PApplet.split(importStr, ','));
for (String importName : importList) {
if (!importName.isEmpty()) {
outgoing.append(importName);
}
}
}
return (outgoing.size() > 0) ? outgoing : null;
}
Aggregations