Package org.ametys.core.util.path
Class PathSource.PathSourceOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.ametys.core.util.path.PathSource.PathSourceOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
- Enclosing class:
- PathSource
private static class PathSource.PathSourceOutputStream extends OutputStream
A file outputStream that will rename the temp file to the destination file upon close() and discard the temp file upon cancel().
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
_isClosed
private OutputStream
_os
private PathSource
_source
private Path
_tmpFile
-
Constructor Summary
Constructors Constructor Description PathSourceOutputStream(Path tmpFile, PathSource source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canCancel()
void
cancel()
void
close()
void
finalize()
void
flush()
PathSource
getSource()
void
write(int b)
-
Methods inherited from class java.io.OutputStream
nullOutputStream, write, write
-
-
-
-
Field Detail
-
_os
private OutputStream _os
-
_isClosed
private boolean _isClosed
-
_source
private PathSource _source
-
-
Constructor Detail
-
PathSourceOutputStream
public PathSourceOutputStream(Path tmpFile, PathSource source) throws IOException
- Throws:
IOException
-
-
Method Detail
-
write
public void write(int b) throws IOException
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
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
-
canCancel
public boolean canCancel()
-
getSource
public PathSource getSource()
-
-