Package org.eclipse.jgit.lib

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


    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

      return ours;

    ObjectLoader lo = reader.open(ours.getData());
    ObjectLoader lt = reader.open(theirs.getData());
    UnionInputStream union = new UnionInputStream(lo.openStream(),
        lt.openStream());
    try {
      ObjectId noteData = inserter.insert(Constants.OBJ_BLOB,
          lo.getSize() + lt.getSize(), union);
      return new Note(ours, noteData);
    } finally {
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

    assertEquals(data3.length, ol.getSize());
    assertFalse("is large", ol.isLarge());
    assertNotNull(ol.getCachedBytes());
    assertArrayEquals(data3, ol.getCachedBytes());

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

          } finally {
            dcIn.close();
          }

          dcIn = new EolCanonicalizingInputStream(
              loader.openStream(), true);
          byte[] autoCrLfHash = computeHash(dcIn, dcInLen);
          boolean changed = getEntryObjectId().compareTo(
              autoCrLfHash, 0) != 0;
          return changed;
        } catch (IOException e) {
View Full Code Here

            return true;

          // We need to compute the length, but only if it is not
          // a binary stream.
          dcIn = new EolCanonicalizingInputStream(
              loader.openStream(), true, true /* abort if binary */);
          long dcInLen;
          try {
            dcInLen = computeLength(dcIn);
          } catch (EolCanonicalizingInputStream.IsBinaryException e) {
            return true;
View Full Code Here

      ObjectId objId = treeWalk.getObjectId(0);
      ObjectLoader loader = repo.open(objId);
      response.setHeader("Cache-Control", "no-cache"); //$NON-NLS-1$
      response.setHeader("ETag", "\"" + tree.getId().getName() + "\""); //$NON-NLS-1$ //$NON-NLS-2$
      response.setContentType("application/octet-stream"); //$NON-NLS-1$
      stream = loader.openStream();
      IOUtilities.pipe(stream, response.getOutputStream(), true, false);
    } catch (MissingObjectException e) {
    } catch (IOException e) {
    } finally {
      try {
View Full Code Here

    byte[] sep = new byte[] {'\n'};
    ObjectLoader lt = reader.open(theirs.getData());
    UnionInputStream union = new UnionInputStream(
        lo.openStream(),
        new ByteArrayInputStream(sep),
        lt.openStream());
    ObjectId noteData = inserter.insert(Constants.OBJ_BLOB,
        lo.getSize() + sep.length + lt.getSize(), union);
    return new Note(ours, noteData);
  }
}
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.