Methods Summary |
---|
private void | addElement(ClassPathElement element)
assert element != null;
elements.add(element);
|
synchronized com.android.dx.cf.direct.DirectClassFile | getClass(java.lang.String path)
DirectClassFile classFile = null;
for (ClassPathElement element : elements) {
try {
InputStream in = element.open(path);
try {
byte[] bytes = readStream(in, baos, readBuffer);
baos.reset();
classFile = new DirectClassFile(bytes, path, false);
classFile.setAttributeFactory(StdAttributeFactory.THE_ONE);
break;
} finally {
in.close();
}
} catch (IOException e) {
// search next element
}
}
if (classFile == null) {
throw new FileNotFoundException("File \"" + path + "\" not found");
}
return classFile;
|
static ClassPathElement | getClassPathElement(java.io.File file)
if (file.isDirectory()) {
return new FolderPathElement(file);
} else if (file.isFile()) {
return new ArchivePathElement(new ZipFile(file));
} else if (file.exists()) {
throw new IOException("\"" + file.getPath() +
"\" is not a directory neither a zip file");
} else {
throw new FileNotFoundException("File \"" + file.getPath() + "\" not found");
}
|
java.lang.Iterable | getElements()
return elements;
|
private static byte[] | readStream(java.io.InputStream in, java.io.ByteArrayOutputStream baos, byte[] readBuffer)
try {
for (;;) {
int amt = in.read(readBuffer);
if (amt < 0) {
break;
}
baos.write(readBuffer, 0, amt);
}
} finally {
in.close();
}
return baos.toByteArray();
|
public java.lang.String | toString()
return definition;
|