public class ChangedFileOutputStream
extends java.io.OutputStream
close() method. This results in missed/ignored IOExceptions in some
cases. First, OutputStream.flush() method does not actually flush buffer to the disk. Second, any problems writing to the
file will be reported as IOException thrown by close(), which are generally ignored.| Modifier and Type | Field and Description |
|---|---|
private java.io.ByteArrayOutputStream |
buffer |
private org.sonatype.plexus.build.incremental.BuildContext |
buildContext |
private java.io.File |
file |
private java.io.OutputStream |
os |
| Constructor and Description |
|---|
ChangedFileOutputStream(java.io.File file) |
ChangedFileOutputStream(java.io.File file,
org.sonatype.plexus.build.incremental.BuildContext buildContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
protected void |
writeIfNewOrChanged() |
private final java.io.File file
private final org.sonatype.plexus.build.incremental.BuildContext buildContext
private final java.io.OutputStream os
private java.io.ByteArrayOutputStream buffer
public ChangedFileOutputStream(java.io.File file)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic ChangedFileOutputStream(java.io.File file,
org.sonatype.plexus.build.incremental.BuildContext buildContext)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic void write(int b)
write in class java.io.OutputStreampublic void write(byte[] b,
int off,
int len)
write in class java.io.OutputStreampublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.OutputStreamjava.io.IOExceptionprotected void writeIfNewOrChanged()
throws java.io.IOException
java.io.IOException