private File manageFileList(FileList fl) throws IOException, InterruptedException { final File fromDir = fl.getDir(getProject()); final String[] srcFiles = fl.getFiles(getProject()); for (String src : srcFiles) { final File f = new File(fromDir, src); final boolean error = processingSingleFile(f); if (error) { return f; } } return null; }
/** * Fulfill the ResourceCollection contract. * @return number of elements as int. * @since Ant 1.7 */ @Override public int size() { if (isReference()) { return getRef(getProject()).size(); } return filenames.size(); }
/** * @param p the current project * @return the directory attribute */ public File getDir(Project p) { if (isReference()) { return getRef(p).getDir(p); } return dir; }
/** * A copy constructor. * * @param filelist a <code>FileList</code> value */ protected FileList(FileList filelist) { this.dir = filelist.dir; this.filenames = filelist.filenames; setProject(filelist.getProject()); }
/** * Write an Ant file list * * @param fileList * @param id */ public void writeFileList( FileList fileList, String id ) { writer.startElement( "filelist" ); writer.addAttribute( "id", id ); File dir = fileList.getDir( fileList.getProject() ); writer.addAttribute( "dir", dir.getAbsolutePath() ); String[] files = fileList.getFiles( fileList.getProject() ); for ( int i = 0; i < files.length; ++i ) { writer.startElement( "file" ); writer.addAttribute( "name", files[i] ); writer.endElement(); } writer.endElement(); }
private void manageFileList(FileList fileList) { boolean error = false; final String[] srcFiles = fileList.getFiles(getProject()); for (String s : srcFiles) { if (isPresentInFile(s) == false) { myLog("Missing " + s); error = true; } } if (error) { throw new BuildException("Some entries are missing in the zipfile"); } }
/** * Returns the list of files represented by this FileList. * @param p the current project * @return the list of files represented by this FileList. */ public String[] getFiles(Project p) { if (isReference()) { return getRef(p).getFiles(p); } if (dir == null) { throw new BuildException("No directory specified for filelist."); } if (filenames.isEmpty()) { throw new BuildException("No files specified for filelist."); } return filenames.toArray(new String[filenames.size()]); }
/** * Fulfill the ResourceCollection contract. * @return an Iterator of Resources. * @since Ant 1.7 */ @Override public Iterator<Resource> iterator() { if (isReference()) { return getRef(getProject()).iterator(); } return new FileResourceIterator(getProject(), dir, filenames.toArray(new String[filenames.size()])); }
FileList fileList = new FileList(); fileList.setDir( getLocalRepository().getLocation() ); fileSet.setDir( fileList.getDir( getProject() ) ); file.setName( filename ); fileList.addConfiguredFile( file );
String pageToken = null; do { FileList result = driveService.files().list() .setQ("mimeType='image/jpeg'") .setSpaces("drive") .setFields("nextPageToken, files(id, name)") .setPageToken(pageToken) .execute(); for(File file: result.getFiles()) { System.out.printf("Found file: %s (%s)\n", file.getName(), file.getId()); } pageToken = result.getNextPageToken(); } while (pageToken != null);
private void deployContributions() throws BuildException { List<ContributionSource> sources = new ArrayList<ContributionSource>(); for (FileList list : contributions) { Project project = list.getProject(); File dir = list.getDir(project); for (String file : list.getFiles(project)) { FileContributionSource source = createContributionSource(dir, file); sources.add(source);
Drive.Files.List request = mService.files() .list() .setFields("files/thumbnailLink, files/name, files/mimeType, files/id") .setQ("Your file param and/or mime query"); FileList files = request.execute(); files.getFiles(); //Each File in the collection will have a valid thumbnailLink
/** * Adds a nested <code><filelist></code> element. * @param fl a <code>FileList</code> to be added to the path * @throws BuildException on error */ public void addFilelist(FileList fl) throws BuildException { if (fl.getProject() == null) { fl.setProject(getProject()); } add(fl); }
/** * Return the list of files or directories from this FileList that * should be included on the command line. * @param list the FileList to check. * @return a String[] containing the directory names. * * @since Ant 1.6.2 */ protected String[] getFilesAndDirs(FileList list) { return restrict(list.getFiles(getProject()), list.getDir(getProject())); }
Drive.Files.List request = mService.files() .list() .setFields("files/thumbnailLink, files/name, files/mimeType, files/id") .setQ("Your file param and/or mime query"); FileList files = request.execute(); files.getFiles(); //Each File in the collection will have a valid thumbnailLink
List<String> fileInfo = new ArrayList<String>(); FileList result = mService.files().list() .setPageSize(10) .setFields("nextPageToken, items(id, name)") .execute(); List<File> files = result.getFiles(); if (files != null) { for (File file : files) { fileInfo.add(String.format("%s (%s)\n", file.getName(), file.getId())); } }
private File manageFileList(FileList fl) throws IOException, InterruptedException { final File fromDir = fl.getDir(getProject()); final String[] srcFiles = fl.getFiles(getProject()); for (String src : srcFiles) { final File f = new File(fromDir, src); final boolean error = processingSingleFile(f); if (error) { return f; } } return null; }
private List<String> getDataFromApi() throws IOException { // Get a list of up to 10 files. List<String> fileInfo = new ArrayList<String>(); FileList result = mService.files().list() .setPageSize(10) // see createdTime added to list of requested fields .setFields("nextPageToken, files(createdTime,id,name)") .execute(); List<File> files = result.getFiles(); if (files != null) { for (File file : files) { fileInfo.add(String.format("%s (%s)\n", file.getName(), file.getId())); } } return fileInfo; }
/** * Returns the most recent modified timestamp of the file collection. * * Note: this must be combined into one method to account for both * Path and FileList erasure types. * * @param fileLists Collection of FileList or Path * @return Most recent modified timestamp */ private long getLastModifiedTime(List<?> fileLists) { long lastModified = 0; for (Object entry : fileLists) { if (entry instanceof FileList) { FileList list = (FileList) entry; for (String fileName : list.getFiles(this.getProject())) { File path = list.getDir(this.getProject()); File file = new File(path, fileName); lastModified = Math.max(getLastModifiedTime(file), lastModified); } } else if (entry instanceof Path) { Path path = (Path) entry; for (String src : path.list()) { File file = new File(src); lastModified = Math.max(getLastModifiedTime(file), lastModified); } } } return lastModified; }