Package org.eclipse.jgit.lib

Examples of org.eclipse.jgit.lib.ObjectLoader.openStream()


    //
    final ObjectId myId = getObjectId();
    final WindowCursor wc = new WindowCursor(db);
    ObjectLoader ldr = db.openObject2(wc, myId.name(), myId);
    if (ldr != null)
      return ldr.openStream();

    InputStream in = open(wc);
    in = new BufferedInputStream(in, 8192);

    // While we inflate the object, also deflate it back as a loose
View Full Code Here


      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();
View Full Code Here

      return ours;

    ObjectLoader lo = reader.open(ours.getData());
    ObjectLoader lt = reader.open(theirs.getData());
    UnionInputStream union = new UnionInputStream(lo.openStream(),
        lt.openStream());
    ObjectId noteData = inserter.insert(Constants.OBJ_BLOB,
        lo.getSize() + lt.getSize(), union);
    return new Note(ours, noteData);
  }
}
View Full Code Here

            }

            // index the blob content
            if (StringUtils.isEmpty(ext) || !excludedExtensions.contains(ext)) {
              ObjectLoader ldr = repository.open(blobId, Constants.OBJ_BLOB);
              InputStream in = ldr.openStream();
              int n;
              while ((n = in.read(tmp)) > 0) {
                os.write(tmp, 0, n);
              }
              in.close();
View Full Code Here

        final ObjectLoader loader = super.open(objectId, typeHint);
        return new ObjectLoader() {

          public ObjectStream openStream()
              throws MissingObjectException, IOException {
            return loader.openStream();
          }

          public int getType() {
            return loader.getType();
          }
View Full Code Here

    assertEquals(type, ol.getType());
    assertEquals(data.length, ol.getSize());
    assertFalse("is not large", ol.isLarge());
    assertTrue("same content", Arrays.equals(data, ol.getCachedBytes()));

    ObjectStream in = ol.openStream();
    assertNotNull("have stream", in);
    assertEquals(type, in.getType());
    assertEquals(data.length, in.getSize());
    byte[] data2 = new byte[data.length];
    IO.readFully(in, data2, 0, data.length);
View Full Code Here

      assertEquals(MessageFormat.format(
          JGitText.get().largeObjectException, id.name()), tooBig
          .getMessage());
    }

    ObjectStream in = ol.openStream();
    assertNotNull("have stream", in);
    assertEquals(type, in.getType());
    assertEquals(data.length, in.getSize());
    byte[] data2 = new byte[data.length];
    IO.readFully(in, data2, 0, data.length);
View Full Code Here

      }
    }

    try {
      byte[] tmp = new byte[data.length];
      InputStream in = ol.openStream();
      try {
        IO.readFully(in, tmp, 0, tmp.length);
      } finally {
        in.close();
      }
View Full Code Here

        fs.close();
      }
    }

    byte[] tmp = new byte[data.length];
    InputStream in = ol.openStream();
    IO.readFully(in, tmp, 0, tmp.length);
    try {
      in.close();
      fail("close did not throw CorruptObjectException");
    } catch (CorruptObjectException coe) {
View Full Code Here

        fs.close();
      }
    }

    byte[] tmp = new byte[data.length];
    InputStream in = ol.openStream();
    IO.readFully(in, tmp, 0, tmp.length);
    try {
      in.close();
      fail("close did not throw CorruptObjectException");
    } catch (CorruptObjectException coe) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.