Class FSOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.tmatesoft.svn.core.internal.io.fs.FSOutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
,ISVNDeltaConsumer
public class FSOutputStream extends java.io.OutputStream implements ISVNDeltaConsumer
- Version:
- 1.3
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
isHeaderWritten
private SVNDeltaGenerator
myDeltaGenerator
private long
myDeltaStart
private boolean
myIsClosed
private boolean
myIsCompress
private java.security.MessageDigest
myMD5Digest
private long
myRepOffset
private long
myRepSize
private FSRevisionNode
myRevNode
private java.security.MessageDigest
mySHA1Digest
private long
mySourceOffset
private java.io.InputStream
mySourceStream
private java.io.File
myTargetFile
private CountingOutputStream
myTargetFileOS
private java.io.ByteArrayOutputStream
myTextBuffer
private FSWriteLock
myTxnLock
private FSTransactionRoot
myTxnRoot
static int
SVN_DELTA_WINDOW_SIZE
static int
WRITE_BUFFER_SIZE
-
Constructor Summary
Constructors Modifier Constructor Description private
FSOutputStream(FSRevisionNode revNode, CountingOutputStream targetFileOS, java.io.File targetFile, java.io.InputStream source, long deltaStart, long repSize, long repOffset, FSTransactionRoot txnRoot, boolean compress, FSWriteLock txnLock)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyTextDelta(java.lang.String path, java.lang.String baseChecksum)
Starts applying text delta(s) to an opened file.private void
checkRepresentation(FSFS fsfs, FSRepresentation representation, java.lang.Object hint)
void
close()
void
closeStreams()
static java.io.OutputStream
createStream(FSRevisionNode revNode, FSTransactionRoot txnRoot, java.io.OutputStream dstStream, boolean compress)
FSRevisionNode
getRevisionNode()
private FSRepresentation
getSharedRepresentation(FSFS fsfs, FSRepresentation representation, java.util.Map<java.lang.String,FSRepresentation> representationsMap)
private FSP2LEntry
lookupEntry(java.util.List<FSP2LEntry> entries, long offset, java.lang.Object hint)
private FSP2LEntry
lookupP2LEntry(FSFile revFile, long revision, long offset)
private static java.io.File
pathTxnSha1(FSFS fsfs, FSRepresentation representation, java.lang.String txnId)
private void
reset(FSRevisionNode revNode, CountingOutputStream targetFileOS, java.io.File targetFile, java.io.InputStream source, long deltaStart, long repSize, long repOffset, FSTransactionRoot txnRoot, FSWriteLock txnLock)
private static void
storeSha1RepMapping(FSFS fsfs, FSRepresentation representation)
java.io.OutputStream
textDeltaChunk(java.lang.String path, SVNDiffWindow diffWindow)
Collects a next delta chunk.void
textDeltaEnd(java.lang.String path)
Finalizes collecting text delta(s).void
write(byte[] b)
void
write(byte[] b, int off, int len)
void
write(int b)
-
-
-
Field Detail
-
SVN_DELTA_WINDOW_SIZE
public static final int SVN_DELTA_WINDOW_SIZE
- See Also:
- Constant Field Values
-
WRITE_BUFFER_SIZE
public static final int WRITE_BUFFER_SIZE
- See Also:
- Constant Field Values
-
isHeaderWritten
private boolean isHeaderWritten
-
myTargetFileOS
private CountingOutputStream myTargetFileOS
-
myTargetFile
private java.io.File myTargetFile
-
myDeltaStart
private long myDeltaStart
-
myRepSize
private long myRepSize
-
myRepOffset
private long myRepOffset
-
mySourceStream
private java.io.InputStream mySourceStream
-
myDeltaGenerator
private SVNDeltaGenerator myDeltaGenerator
-
myRevNode
private FSRevisionNode myRevNode
-
myMD5Digest
private java.security.MessageDigest myMD5Digest
-
mySHA1Digest
private java.security.MessageDigest mySHA1Digest
-
myTxnRoot
private FSTransactionRoot myTxnRoot
-
mySourceOffset
private long mySourceOffset
-
myTextBuffer
private java.io.ByteArrayOutputStream myTextBuffer
-
myIsClosed
private boolean myIsClosed
-
myIsCompress
private boolean myIsCompress
-
myTxnLock
private FSWriteLock myTxnLock
-
-
Constructor Detail
-
FSOutputStream
private FSOutputStream(FSRevisionNode revNode, CountingOutputStream targetFileOS, java.io.File targetFile, java.io.InputStream source, long deltaStart, long repSize, long repOffset, FSTransactionRoot txnRoot, boolean compress, FSWriteLock txnLock) throws SVNException
- Throws:
SVNException
-
-
Method Detail
-
reset
private void reset(FSRevisionNode revNode, CountingOutputStream targetFileOS, java.io.File targetFile, java.io.InputStream source, long deltaStart, long repSize, long repOffset, FSTransactionRoot txnRoot, FSWriteLock txnLock)
-
createStream
public static java.io.OutputStream createStream(FSRevisionNode revNode, FSTransactionRoot txnRoot, java.io.OutputStream dstStream, boolean compress) throws SVNException
- Throws:
SVNException
-
write
public void write(int b) throws java.io.IOException
- Specified by:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] b) throws java.io.IOException
- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
closeStreams
public void closeStreams() throws java.io.IOException
- Throws:
java.io.IOException
-
getRevisionNode
public FSRevisionNode getRevisionNode()
-
textDeltaChunk
public java.io.OutputStream textDeltaChunk(java.lang.String path, SVNDiffWindow diffWindow) throws SVNException
Description copied from interface:ISVNDeltaConsumer
Collects a next delta chunk. The return type is nomore relevant and is left only for backward compatibility. So, the return value may be just null. Otherwise if it's not null, the stream will be immediately closed.If there are more than one windows for the file, this method is called several times.
- Specified by:
textDeltaChunk
in interfaceISVNDeltaConsumer
- Parameters:
path
- a file path relative to the edit root directorydiffWindow
- a next diff window- Returns:
- an output stream
- Throws:
SVNException
-
textDeltaEnd
public void textDeltaEnd(java.lang.String path) throws SVNException
Description copied from interface:ISVNDeltaConsumer
Finalizes collecting text delta(s).- Specified by:
textDeltaEnd
in interfaceISVNDeltaConsumer
- Parameters:
path
- a file path relative to the edit root directory- Throws:
SVNException
-
applyTextDelta
public void applyTextDelta(java.lang.String path, java.lang.String baseChecksum) throws SVNException
Description copied from interface:ISVNDeltaConsumer
Starts applying text delta(s) to an opened file.- Specified by:
applyTextDelta
in interfaceISVNDeltaConsumer
- Parameters:
path
- a file path relative to the edit root directorybaseChecksum
- an MD5 checksum for the base file contents (before the file is changed)- Throws:
SVNException
- if the calculated base file checksum didn't match the expectedbaseChecksum
-
getSharedRepresentation
private FSRepresentation getSharedRepresentation(FSFS fsfs, FSRepresentation representation, java.util.Map<java.lang.String,FSRepresentation> representationsMap) throws SVNException
- Throws:
SVNException
-
checkRepresentation
private void checkRepresentation(FSFS fsfs, FSRepresentation representation, java.lang.Object hint) throws SVNException
- Throws:
SVNException
-
lookupP2LEntry
private FSP2LEntry lookupP2LEntry(FSFile revFile, long revision, long offset) throws SVNException
- Throws:
SVNException
-
lookupEntry
private FSP2LEntry lookupEntry(java.util.List<FSP2LEntry> entries, long offset, java.lang.Object hint)
-
storeSha1RepMapping
private static void storeSha1RepMapping(FSFS fsfs, FSRepresentation representation) throws SVNException
- Throws:
SVNException
-
pathTxnSha1
private static java.io.File pathTxnSha1(FSFS fsfs, FSRepresentation representation, java.lang.String txnId)
-
-