Refactor TemporaryBuffer to support reuse in other contexts
commit3f8fdc03253264cae2172c168b5c959ea09a4c9d
authorShawn O. Pearce <sop@google.com>
Fri, 27 Nov 2009 04:16:30 +0000 (26 20:16 -0800)
committerShawn O. Pearce <spearce@spearce.org>
Tue, 12 Jan 2010 19:56:55 +0000 (12 11:56 -0800)
tree5a1e46a1a78cdd3c52121e2a594b847933138bcb
parenta22b8f5fac9dd9b99333d709e6ef8f09ca6cd0d7
Refactor TemporaryBuffer to support reuse in other contexts

Later we are going to add support for smart HTTP, which requires us to
buffer at least some of the request created by a client before we ship
it to the server.  For many requests, we can fit it completely into a
1 MiB buffer, but if it doesn't we can drop back to using the chunked
transfer encoding to send an unknown stream length.

Rather than recoding the block based memory buffer, we refactor the
local file overflow strategy into a subclass, allowing the HTTP client
code to replace this portion of the logic with its own approach to
start the chunked encoding request.

Change-Id: Iac61ea1017b14e0ad3c4425efc3d75718b71bb8e
Signed-off-by: Shawn O. Pearce <sop@google.com>
org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/util/TemporaryBufferTest.java
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java
org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java