/** * Create a virtual tree hierarchy with a buffer supporting the leaf. * @param path Position of the buffer in the hierarchy, including its name * @param content The actual buffer backing the end leaf * @return The FSEntry root for this hierarchy * @throws Exception Invalid parameter */ static public FSEntry getPositionedBuffer(String path, byte[] content) throws Exception { List<String> pathFrags = FSEntrySupport.interpretPath(path); // Start at leaf and work our way back int index = pathFrags.size() - 1; FSEntry root = new FSEntryBuffer(pathFrags.get(index), content); --index; while(index >= 0){ FSEntryVirtualDirectory parent = new FSEntryVirtualDirectory(pathFrags.get(index)); parent.addChildEntry(root); root = parent; --index; } return root; }
@Override public String getExtension() { return FSEntrySupport.extensionFromName(getName()); }
FSEntry f = FSEntryBuffer.getPositionedBuffer("a/vendor/nunaliit2/atlas.js", sw.toString()); mergedEntries.add(f); f = FSEntryBuffer.getPositionedBuffer("a/_attachments/lib/atlas.js", sw.toString()); mergedEntries.add(f);
FSEntry f = FSEntryBuffer.getPositionedBuffer("a/_id.txt", "_design/submission"); entries.add(f); FSEntry f = FSEntryBuffer.getPositionedBuffer("a/vendor/nunaliit2/atlas.js", sw.toString()); entries.add(f);
FSEntry f = FSEntryBuffer.getPositionedBuffer("a/_id.txt", "_design/mobile"); entries.add(f); FSEntry f = FSEntryBuffer.getPositionedBuffer("a/vendor/nunaliit2/atlas.js", sw.toString()); entries.add(f);
/** * Create a virtual tree hierarchy with a buffer supporting the leaf. * @param path Position of the buffer in the hierarchy, including its name * @param content The actual content, expressed as a String, backing the end leaf * @return The FSEntry root for this hierarchy * @throws Exception Invalid parameter */ static public FSEntry getPositionedBuffer(String path, String content) throws Exception { List<String> pathFrags = FSEntrySupport.interpretPath(path); // Start at leaf and work our way back int index = pathFrags.size() - 1; FSEntry root = new FSEntryBuffer(pathFrags.get(index), content); --index; while(index >= 0){ FSEntryVirtualDirectory parent = new FSEntryVirtualDirectory(pathFrags.get(index)); parent.addChildEntry(root); root = parent; --index; } return root; }
FSEntry f = FSEntryBuffer.getPositionedBuffer("a/_id.txt", "_design/atlas"); entries.add(f); pw.println("}"); FSEntry f = FSEntryBuffer.getPositionedBuffer("a/nunaliit.json", sw.toString()); entries.add(f); FSEntry f = FSEntryBuffer.getPositionedBuffer("a/vendor/nunaliit2/atlas.js", sw.toString()); entries.add(f); f = FSEntryBuffer.getPositionedBuffer("a/_attachments/lib/atlas.js", sw.toString()); entries.add(f); FSEntry f = FSEntryBuffer.getPositionedBuffer("a/language.txt", "javascript"); entries.add(f);