FileDocCategorySizeDatePackage
Path.javaAPI DocAndroid 5.1 API3929Thu Mar 12 22:18:30 GMT 2015com.android.multidex

Path

public class Path extends Object

Fields Summary
List
elements
private final String
definition
private final ByteArrayOutputStream
baos
private final byte[]
readBuffer
Constructors Summary
Path(String definition)


        
        this.definition = definition;
        for (String filePath : definition.split(Pattern.quote(File.pathSeparator))) {
            try {
                addElement(getClassPathElement(new File(filePath)));
            } catch (IOException e) {
                throw new IOException("Wrong classpath: " + e.getMessage(), e);
            }
        }
    
Methods Summary
private voidaddElement(ClassPathElement element)

        assert element != null;
        elements.add(element);
    
synchronized com.android.dx.cf.direct.DirectClassFilegetClass(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 ClassPathElementgetClassPathElement(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.IterablegetElements()

      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.StringtoString()

        return definition;