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 aLockFilewhich 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 voidabort()Aborts the stream.voidclose()AnyLongObjectIdgetId()Get theid.voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)-
Methods inherited from class java.io.OutputStream
flush
-
-
-
-
Constructor Detail
-
AtomicObjectOutputStream
public AtomicObjectOutputStream(Path path, AnyLongObjectId id) throws IOException
Constructor for AtomicObjectOutputStream.- Parameters:
path- aPathobject.id- aAnyLongObjectIdobject.- Throws:
IOException
-
AtomicObjectOutputStream
public AtomicObjectOutputStream(Path path) throws IOException
Constructor for AtomicObjectOutputStream.- Parameters:
path- aPathobject.- 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
nullif called before closing this stream.
-
write
public void write(int b) throws IOException- Specified by:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] b) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
abort
public void abort()
Aborts the stream. Temporary file will be deleted
-
-