Package hudson.util
Class FileChannelWriter
- java.lang.Object
-
- java.io.Writer
-
- hudson.util.FileChannelWriter
-
- All Implemented Interfaces:
Closeable
,Flushable
,Appendable
,AutoCloseable
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public class FileChannelWriter extends Writer
This class has been created to help makeAtomicFileWriter
hopefully 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 void
close()
void
flush()
void
write(char[] cbuf, int off, int len)
-
-
-
Method Detail
-
write
public void write(char[] cbuf, int off, int len) throws IOException
- Specified by:
write
in classWriter
- Throws:
IOException
-
flush
public void flush() throws IOException
- Specified by:
flush
in interfaceFlushable
- Specified by:
flush
in classWriter
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classWriter
- Throws:
IOException
-
-