Package org.eclipse.jgit.storage.pack

Examples of org.eclipse.jgit.storage.pack.DeltaStream


      return wc.open(getObjectId()).openStream();
    }
    delta = new InflaterInputStream(delta);

    final ObjectLoader base = pack.load(wc, baseOffset);
    DeltaStream ds = new DeltaStream(delta) {
      private long baseSize = SIZE_UNKNOWN;

      @Override
      protected InputStream openBase() throws IOException {
        InputStream in;
        if (base instanceof LargePackedDeltaObject)
          in = ((LargePackedDeltaObject) base).open(wc);
        else
          in = base.openStream();
        if (baseSize == SIZE_UNKNOWN) {
          if (in instanceof DeltaStream)
            baseSize = ((DeltaStream) in).getSize();
          else if (in instanceof ObjectStream)
            baseSize = ((ObjectStream) in).getSize();
        }
        return in;
      }

      @Override
      protected long getBaseSize() throws IOException {
        if (baseSize == SIZE_UNKNOWN) {
          // This code path should never be used as DeltaStream
          // is supposed to open the stream first, which would
          // initialize the size for us directly from the stream.
          baseSize = base.getSize();
        }
        return baseSize;
      }
    };
    if (type == Constants.OBJ_BAD) {
      if (!(base instanceof LargePackedDeltaObject))
        type = base.getType();
    }
    if (size == SIZE_UNKNOWN)
      size = ds.getSize();
    return ds;
  }
View Full Code Here


      return wc.open(getObjectId()).openStream();
    }
    delta = new InflaterInputStream(delta);

    final ObjectLoader base = pack.load(wc, baseOffset);
    DeltaStream ds = new DeltaStream(delta) {
      private long baseSize = SIZE_UNKNOWN;

      @Override
      protected InputStream openBase() throws IOException {
        InputStream in;
        if (base instanceof LargePackedDeltaObject)
          in = ((LargePackedDeltaObject) base).open(wc);
        else
          in = base.openStream();
        if (baseSize == SIZE_UNKNOWN) {
          if (in instanceof DeltaStream)
            baseSize = ((DeltaStream) in).getSize();
          else if (in instanceof ObjectStream)
            baseSize = ((ObjectStream) in).getSize();
        }
        return in;
      }

      @Override
      protected long getBaseSize() throws IOException {
        if (baseSize == SIZE_UNKNOWN) {
          // This code path should never be used as DeltaStream
          // is supposed to open the stream first, which would
          // initialize the size for us directly from the stream.
          baseSize = base.getSize();
        }
        return baseSize;
      }
    };
    if (size == SIZE_UNKNOWN)
      size = ds.getSize();
    return ds;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.storage.pack.DeltaStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.