本文整理汇总了Java中com.android.io.FolderWrapper类的典型用法代码示例。如果您正苦于以下问题:Java FolderWrapper类的具体用法?Java FolderWrapper怎么用?Java FolderWrapper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FolderWrapper类属于com.android.io包,在下文中一共展示了FolderWrapper类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkProjectFolder
import com.android.io.FolderWrapper; //导入依赖的package包/类
/**
* Checks whether the give <var>folderPath</var> is a valid project folder, and returns
* a {@link FileWrapper} to the required file.
* <p/>This checks that the folder exists and contains an AndroidManifest.xml file in it.
* <p/>Any error are output using {@link #mLog}.
* @param folderPath the folder to check
* @param requiredFilename the file name of the file that's required.
* @return a {@link FileWrapper} to the AndroidManifest.xml file, or null otherwise.
*/
private FileWrapper checkProjectFolder(String folderPath, String requiredFilename) {
// project folder must exist and be a directory, since this is an update
FolderWrapper projectFolder = new FolderWrapper(folderPath);
if (!projectFolder.isDirectory()) {
mLog.error(null, "Project folder '%1$s' is not a valid directory.",
projectFolder);
return null;
}
// Check AndroidManifest.xml is present
FileWrapper requireFile = new FileWrapper(projectFolder, requiredFilename);
if (!requireFile.isFile()) {
mLog.error(null,
"%1$s is not a valid project (%2$s not found).",
folderPath, requiredFilename);
return null;
}
return requireFile;
}
示例2: resolveFullLibraryDependencies
import com.android.io.FolderWrapper; //导入依赖的package包/类
/**
* Resolves a given list of libraries, finds out if they depend on other libraries, and
* returns a full list of all the direct and indirect dependencies in the proper order (first
* is higher priority when calling aapt).
* @param inLibraries the libraries to resolve
* @param outLibraries where to store all the libraries.
*/
private void resolveFullLibraryDependencies(List<File> inLibraries, List<File> outLibraries) {
// loop in the inverse order to resolve dependencies on the libraries, so that if a library
// is required by two higher level libraries it can be inserted in the correct place
for (int i = inLibraries.size() - 1 ; i >= 0 ; i--) {
File library = inLibraries.get(i);
// get the default.property file for it
final ProjectProperties projectProp = ProjectProperties.load(
new FolderWrapper(library), PropertyType.PROJECT);
// get its libraries
List<File> dependencies = getDirectDependencies(library, projectProp);
// resolve the dependencies for those libraries
resolveFullLibraryDependencies(dependencies, outLibraries);
// and add the current one (if needed) in front (higher priority)
if (outLibraries.contains(library) == false) {
outLibraries.add(0, library);
}
}
}
示例3: loadPlatformResources
import com.android.io.FolderWrapper; //导入依赖的package包/类
private static FrameworkResources loadPlatformResources(
File resFolder, ILogger log) throws IOException {
FolderWrapper path = new FolderWrapper(resFolder);
FrameworkResources resources = new FrameworkResources(path);
resources.loadResources();
resources.loadPublicResources(log);
return resources;
}
示例4: loadResources
import com.android.io.FolderWrapper; //导入依赖的package包/类
private FrameworkResources loadResources(File resFolder, ILogger log) {
FrameworkResources resources = new FrameworkResources();
try {
FolderWrapper path = new FolderWrapper(resFolder);
resources.loadResources(path);
resources.loadPublicResources(path, log);
return resources;
} catch (IOException e) {
// since we test that folders are folders, and files are files, this shouldn't
// happen. We can ignore it.
}
return null;
}
示例5: create
import com.android.io.FolderWrapper; //导入依赖的package包/类
/**
* Creates a resource repository for a resource folder whose contents is identified
* by the pairs of relative paths and file contents
*/
@SuppressWarnings("ResultOfMethodCallIgnored")
@NonNull
public static TestResourceRepository create(boolean isFramework, Object[] data)
throws IOException {
File dir = Files.createTempDir();
File res = new File(dir, FD_RES);
res.mkdirs();
assertTrue("Expected even number of items (path,contents)", data.length % 2 == 0);
for (int i = 0; i < data.length; i += 2) {
Object relativePathObject = data[i];
assertTrue(relativePathObject instanceof String);
String relativePath = (String) relativePathObject;
relativePath = relativePath.replace('/', File.separatorChar);
File file = new File(res, relativePath);
File parent = file.getParentFile();
parent.mkdirs();
Object fileContents = data[i + 1];
if (fileContents instanceof String) {
String text = (String) fileContents;
Files.write(text, file, Charsets.UTF_8);
} else if (fileContents instanceof byte[]) {
byte[] bytes = (byte[]) fileContents;
Files.write(bytes, file);
} else {
fail("File contents must be Strings or byte[]'s");
}
}
IAbstractFolder resFolder = new FolderWrapper(dir, FD_RES);
return new TestResourceRepository(resFolder, isFramework, dir);
}
示例6: BufferingFolderWrapper
import com.android.io.FolderWrapper; //导入依赖的package包/类
public BufferingFolderWrapper(@NotNull File file) {
myFile = file;
myDelegate = new FolderWrapper(file);
}
示例7: create
import com.android.io.FolderWrapper; //导入依赖的package包/类
/**
* Creates a new project properties object, with no properties.
* <p/>The file is not created until {@link ProjectPropertiesWorkingCopy#save()} is called.
* @param projectFolderOsPath the project folder.
* @param type the type of property file to create
*
* @see #createEmpty(String, PropertyType)
*/
public static ProjectPropertiesWorkingCopy create(@NonNull String projectFolderOsPath,
@NonNull PropertyType type) {
// create and return a ProjectProperties with an empty map.
IAbstractFolder folder = new FolderWrapper(projectFolderOsPath);
return create(folder, type);
}
示例8: createEmpty
import com.android.io.FolderWrapper; //导入依赖的package包/类
/**
* Creates a new project properties object, with no properties.
* <p/>Nothing can be added to it, unless a {@link ProjectPropertiesWorkingCopy} is created
* first with {@link #makeWorkingCopy()}.
* @param projectFolderOsPath the project folder.
* @param type the type of property file to create
*
* @see #create(String, PropertyType)
*/
public static ProjectProperties createEmpty(@NonNull String projectFolderOsPath,
@NonNull PropertyType type) {
// create and return a ProjectProperties with an empty map.
IAbstractFolder folder = new FolderWrapper(projectFolderOsPath);
return createEmpty(folder, type);
}
示例9: load
import com.android.io.FolderWrapper; //导入依赖的package包/类
/**
* Loads a project properties file and return a {@link ProjectProperties} object
* containing the properties.
*
* @param projectFolderOsPath the project folder.
* @param type One the possible {@link PropertyType}s.
*/
public static ProjectProperties load(String projectFolderOsPath, PropertyType type) {
IAbstractFolder wrapper = new FolderWrapper(projectFolderOsPath);
return load(wrapper, type);
}
示例10: delete
import com.android.io.FolderWrapper; //导入依赖的package包/类
/**
* Deletes a project properties file.
*
* @param projectFolderOsPath the project folder.
* @param type One the possible {@link PropertyType}s.
* @return true if success.
*/
public static boolean delete(String projectFolderOsPath, PropertyType type) {
IAbstractFolder wrapper = new FolderWrapper(projectFolderOsPath);
return delete(wrapper, type);
}