@Override public String getName() { return entries.get(0).getName(); }
public void addChildEntry(FSEntry entry){ childrenByName.put(entry.getName(), entry); }
@Override public List<FSEntry> getChildren(FSEntryNameFilter filter) { if( null == filter ){ filter = FSEntryNameFilter.all; } List<FSEntry> result = new ArrayList<FSEntry>(childrenByName.size()); for(FSEntry entry : childrenByName.values()){ String childName = entry.getName(); if( filter.accept(this, childName) ) { result.add(entry); } } return result; }
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 } } } } }
throw new Exception("Error while reading file: "+file.getName(), e);
if( null != childEntries ){ for(FSEntry childEntry : childEntries){ String childName = childEntry.getName(); List<FSEntry> children = childrenFromName.get(childName); if( null == children ){
throw new Exception("Error while reading file: "+file.getName(), e);
String toPath = "<unknown>"; try { fromPath = sourceFile.getName(); toPath = targetFile.getAbsolutePath();
String toPath = "<unknown>"; try { fromPath = sourceFile.getName(); toPath = targetFile.getAbsolutePath();
List<FSEntry> children = seekedEntry.getChildren(); for(FSEntry child : children){ if( pathFrag.equals(child.getName()) ){
String childName = child.getName(); if( child.isDirectory() ){
String childName = child.getName();
String childName = child.getName();
String childName = child.getName();
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); } } }