/** * Construct a content source for a working directory. * * If the iterator is a {@link org.eclipse.jgit.treewalk.FileTreeIterator} * an optimized version is used that doesn't require seeking through a * TreeWalk. * * @param iterator * the iterator to obtain source files through. * @return a content source wrapping the iterator. */ public static ContentSource create(WorkingTreeIterator iterator) { return new WorkingTreeSource(iterator); }
@Override public ObjectLoader open(String path, ObjectId id) throws IOException { seek(path); long entrySize = ptr.getEntryContentLength(); return new ObjectLoader() {
@Override public ObjectLoader open(String path, ObjectId id) throws IOException { seek(path); return new ObjectLoader() { @Override public long getSize() { return ptr.getEntryLength(); } @Override public int getType() { return ptr.getEntryFileMode().getObjectType(); } @Override public ObjectStream openStream() throws MissingObjectException, IOException { long contentLength = ptr.getEntryContentLength(); InputStream in = ptr.openEntryStream(); in = new BufferedInputStream(in); return new ObjectStream.Filter(getType(), contentLength, in); } @Override public boolean isLarge() { return true; } @Override public byte[] getCachedBytes() throws LargeObjectException { throw new LargeObjectException(); } }; }
/** * Construct a content source for a working directory. * * If the iterator is a {@link FileTreeIterator} an optimized version is * used that doesn't require seeking through a TreeWalk. * * @param iterator * the iterator to obtain source files through. * @return a content source wrapping the iterator. */ public static ContentSource create(WorkingTreeIterator iterator) { return new WorkingTreeSource(iterator); }
@Override public long size(String path, ObjectId id) throws IOException { seek(path); return ptr.getEntryLength(); }
@Override public long size(String path, ObjectId id) throws IOException { seek(path); return ptr.getEntryLength(); }
@Override public ObjectLoader open(String path, ObjectId id) throws IOException { seek(path); long entrySize = ptr.getEntryContentLength(); return new ObjectLoader() {
/** * Construct a content source for a working directory. * * If the iterator is a {@link org.eclipse.jgit.treewalk.FileTreeIterator} * an optimized version is used that doesn't require seeking through a * TreeWalk. * * @param iterator * the iterator to obtain source files through. * @return a content source wrapping the iterator. */ public static ContentSource create(WorkingTreeIterator iterator) { return new WorkingTreeSource(iterator); }
@Override public long size(String path, ObjectId id) throws IOException { seek(path); return ptr.getEntryLength(); }