Package org.eclipse.jgit.lfs.internal
Class AtomicObjectOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.eclipse.jgit.lfs.internal.AtomicObjectOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class AtomicObjectOutputStream extends OutputStream
Output stream writing content to aLockFile
which is committed on close(). The stream checks if the hash of the stream content matches the id.
-
-
Constructor Summary
Constructors Constructor Description AtomicObjectOutputStream(Path path)
Constructor for AtomicObjectOutputStream.AtomicObjectOutputStream(Path path, AnyLongObjectId id)
Constructor for AtomicObjectOutputStream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abort()
Aborts the stream.void
close()
AnyLongObjectId
getId()
Get theid
.void
write(byte[] b)
void
write(byte[] b, int off, int len)
void
write(int b)
-
Methods inherited from class java.io.OutputStream
flush, nullOutputStream
-
-
-
-
Constructor Detail
-
AtomicObjectOutputStream
public AtomicObjectOutputStream(Path path, AnyLongObjectId id) throws IOException
Constructor for AtomicObjectOutputStream.- Parameters:
path
- aPath
object.id
- aAnyLongObjectId
object.- Throws:
IOException
-
AtomicObjectOutputStream
public AtomicObjectOutputStream(Path path) throws IOException
Constructor for AtomicObjectOutputStream.- Parameters:
path
- aPath
object.- Throws:
IOException
-
-
Method Detail
-
getId
@Nullable public AnyLongObjectId getId()
Get theid
.- Returns:
- content hash of the object which was streamed through this
stream. May return
null
if called before closing this stream.
-
write
public void write(int b) throws IOException
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(byte[] b) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
abort
public void abort()
Aborts the stream. Temporary file will be deleted
-
-