Package org.eclipse.jgit.lib

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


        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


    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

      fail("Should have thrown LargeObjectException");
    } catch (LargeObjectException tooBig) {
      assertEquals(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

      e = new LargeObjectException(objId.copy());
      e.initCause(noMemory);
      throw e;
    }
    InputStream in = ldr.openStream();
    try {
      IO.readFully(in, buf, 0, buf.length);
    } finally {
      in.close();
    }
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

    try {
      ObjectLoader loader = commit.getRepository().open(note.getData(),
          Constants.OBJ_BLOB);
      byte[] contents;
      if (loader.isLarge())
        contents = IO.readWholeStream(loader.openStream(),
            (int) loader.getSize()).array();
      else
        contents = loader.getCachedBytes();
      return RawParseUtils.decode(contents);
    } catch (IOException e) {
View Full Code Here

                    BinaryValue value = values.binaryFor(key, fileLoader.getSize());
                    if (value == null) {
                        // It wasn't found in the binary store ...
                        if (fileLoader.isLarge()) {
                            // Too large to hold in memory, so use the binary store (which reads the file immediately) ...
                            value = values.binaryFrom(fileLoader.openStream());
                        } else {
                            // This is small enough to fit into a byte[], but it still may be pretty big ...
                            value = new GitBinaryValue(fileObjectId, fileLoader, connector.getSourceName(), name,
                                                       connector.getMimeTypeDetector());
                        }
View Full Code Here

    //
    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

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.