@Override public boolean canExecute() { return entries.get(0).canExecute(); } }
@Override public InputStream getInputStream() throws Exception { for(FSEntry entry : entries){ InputStream is = entry.getInputStream(); if( null != is ) { return is; } } return null; }
private void createAttachmentsFromDirectory(String parentName, FSEntry dir) throws Exception { // List all elements in directory List<FSEntry> children = dir.getChildren(filter); // Process each child for(FSEntry child : children) { String childName = child.getName(); if( childName.endsWith(ATT_INFO_PERIOD_EXTENSION) ) { // Skip info files } else if( child.isDirectory() ) { String name = parentName + childName + "/"; createAttachmentsFromDirectory(name, child); } else if( child.isFile() ) { String name = parentName + childName; createAttachmentFromFile(dir, name, child); } } }
if( entry.isDirectory() ){ List<FSEntry> childEntries = entry.getChildren(filter); if( null != childEntries ){ for(FSEntry childEntry : childEntries){ String childName = childEntry.getName(); List<FSEntry> children = childrenFromName.get(childName); if( null == children ){
String toPath = "<unknown>"; try { fromPath = sourceFile.getName(); toPath = targetFile.getAbsolutePath(); is = sourceFile.getInputStream(); fos = new FileOutputStream(targetFile); byte[] buffer = new byte[256]; if( sourceFile.canExecute() ) { targetFile.setExecutable(true, false);
private void insertFile(Writer writer, FSEntry includedEntry) throws Exception { InputStream is = null; char[] buffer = new char[100]; try { is = includedEntry.getInputStream(); InputStreamReader isr = new InputStreamReader(is, "UTF-8"); int size = isr.read(buffer); while( size >= 0 ) { writer.write(buffer, 0, size); size = isr.read(buffer); } writer.flush(); } catch (Exception e) { throw new Exception("Error while reading file: "+includedEntry.getName(), e); } finally { if( null != is ) { try { is.close(); } catch (Exception e) { // Ignore } } } } }
for(String pathFrag : pathFrags){ FSEntry nextEntry = null; List<FSEntry> children = seekedEntry.getChildren(); for(FSEntry child : children){ if( pathFrag.equals(child.getName()) ){
FSEntry infoFile = parentDir.getChild(name+ATT_INFO_PERIOD_EXTENSION); if( null != infoFile && infoFile.isFile() ) { fis = infoFile.getInputStream(); InputStreamReader isr = new InputStreamReader(fis,"UTF-8"); StringWriter sw = new StringWriter();
@Override public boolean isDirectory() { return entries.get(0).isDirectory(); }
@Override public long getSize() throws Exception { return entry.getSize(); }
@Override public boolean exists() { for(FSEntry entry : entries){ if( entry.exists() ) { return true; } } return false; }
@Override public FSEntry getChild(String name) { // Accumulate the lists of files for(FSEntry entry : entries){ FSEntry child = entry.getChild(name); if( null != child ){ return child; } } return null; }
@Override public boolean isFile() { return entries.get(0).isFile(); }
List<FSEntry> children = dir.getChildren(filter); String childName = child.getName(); if( child.isDirectory() ) { if( isChildAnArray ) { obj.put(key, value); } else if( child.isFile() ) { if( isChildJson ) { Object value = readJsonFile(child);
children = sourceDir.getChildren(); } else { children = sourceDir.getChildren(acceptFileFilter); String childName = child.getName(); if( child.isDirectory() ){
String toPath = "<unknown>"; try { fromPath = sourceFile.getName(); toPath = targetFile.getAbsolutePath(); is = sourceFile.getInputStream(); fos = new FileOutputStream(targetFile); if( sourceFile.canExecute() ) { targetFile.setExecutable(true, false);
char[] buffer = new char[100]; try { is = file.getInputStream(); InputStreamReader isr = new InputStreamReader(is, "UTF-8"); throw new Exception("Error while reading file: "+file.getName(), e);
@Override public long getSize() { return entries.get(0).getSize(); }
List<FSEntry> children = dir.getChildren(filter); Collections.sort(children,new Comparator<FSEntry>(){ @Override String childName = child.getName(); if( child.isDirectory() ) { if( isChildAnArray ) { arr.put(value); } else if( child.isFile() ) { if( isChildJson ) { Object value = readJsonFile(child);