Package org.wildfly.security.util
Class AtomicFileOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.wildfly.security.util.AtomicFileOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public final class AtomicFileOutputStream extends OutputStream
- Author:
- David M. Lloyd
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classAtomicFileOutputStream.OpenState(package private) static classAtomicFileOutputStream.State
-
Field Summary
Fields Modifier and Type Field Description private static AtomicFileOutputStream.StateCLOSEDprivate AtomicFileOutputStream.Statecurrentprivate static AtomicReferenceFieldUpdater<AtomicFileOutputStream,AtomicFileOutputStream.State>currentUpdater
-
Constructor Summary
Constructors Constructor Description AtomicFileOutputStream(File file)AtomicFileOutputStream(String name)AtomicFileOutputStream(Path path)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()(package private) booleancasCurrent(AtomicFileOutputStream.State expect, AtomicFileOutputStream.State update)voidclose()voidflush()voidwrite(byte[] bytes, int off, int len)voidwrite(int b)-
Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
-
-
-
Field Detail
-
current
private volatile AtomicFileOutputStream.State current
-
currentUpdater
private static final AtomicReferenceFieldUpdater<AtomicFileOutputStream,AtomicFileOutputStream.State> currentUpdater
-
CLOSED
private static final AtomicFileOutputStream.State CLOSED
-
-
Constructor Detail
-
AtomicFileOutputStream
public AtomicFileOutputStream(String name) throws IOException
- Throws:
IOException
-
AtomicFileOutputStream
public AtomicFileOutputStream(File file) throws IOException
- Throws:
IOException
-
AtomicFileOutputStream
public AtomicFileOutputStream(Path path) throws IOException
- Throws:
IOException
-
-
Method Detail
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
write
public void write(int b) throws IOException- Specified by:
writein classOutputStream- Throws:
IOException
-
write
public void write(byte[] bytes, int off, int len) throws IOException- Overrides:
writein classOutputStream- Throws:
IOException
-
casCurrent
boolean casCurrent(AtomicFileOutputStream.State expect, AtomicFileOutputStream.State update)
-
cancel
public void cancel() throws IOException- Throws:
IOException
-
-