Package hudson.util
Class FileChannelWriter
- java.lang.Object
-
- java.io.Writer
-
- hudson.util.FileChannelWriter
-
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable,Channel
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public class FileChannelWriter extends Writer implements Channel
This class has been created to help makeAtomicFileWriterhopefully more reliable in some corner cases. We created this wrapper to be able to accessFileChannel.force(boolean)which seems to be one of the rare ways to actually have a guarantee that data be flushed to the physical device (only guaranteed for local, not for remote obviously though).The goal using this is to reduce as much as we can the likeliness to see zero-length files be created in place of the original ones.
- See Also:
- JENKINS-34855, PR-2548
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()booleanisOpen()voidwrite(char[] cbuf, int off, int len)
-
-
-
Method Detail
-
write
public void write(char[] cbuf, int off, int len) throws IOException- Specified by:
writein classWriter- Throws:
IOException
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Specified by:
flushin classWriter- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Specified by:
closein classWriter- Throws:
IOException
-
-