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) class
AtomicFileOutputStream.OpenState
(package private) static class
AtomicFileOutputStream.State
-
Field Summary
Fields Modifier and Type Field Description private static AtomicFileOutputStream.State
CLOSED
private AtomicFileOutputStream.State
current
private 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 void
cancel()
(package private) boolean
casCurrent(AtomicFileOutputStream.State expect, AtomicFileOutputStream.State update)
void
close()
void
flush()
void
write(byte[] bytes, int off, int len)
void
write(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:
flush
in interfaceFlushable
- Overrides:
flush
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
-
write
public void write(int b) throws IOException
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(byte[] bytes, int off, int len) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
casCurrent
boolean casCurrent(AtomicFileOutputStream.State expect, AtomicFileOutputStream.State update)
-
cancel
public void cancel() throws IOException
- Throws:
IOException
-
-