Package org.codehaus.plexus.util.io
Class CachingOutputStream
java.lang.Object
java.io.OutputStream
org.codehaus.plexus.util.io.CachingOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
Caching OutputStream to avoid overwriting a file with
the same content.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate FileChannelprivate booleanprivate final Pathprivate ByteBufferprivate ByteBuffer -
Constructor Summary
ConstructorsConstructorDescriptionCachingOutputStream(File path) CachingOutputStream(Path path) CachingOutputStream(Path path, int bufferSize) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidflush()private voidflushBuffer(ByteBuffer writeBuffer) booleanvoidwrite(byte[] b) voidwrite(byte[] b, int off, int len) voidwrite(int b)
-
Field Details
-
path
-
channel
-
readBuffer
-
writeBuffer
-
modified
private boolean modified
-
-
Constructor Details
-
CachingOutputStream
- Throws:
IOException
-
CachingOutputStream
- Throws:
IOException
-
CachingOutputStream
- Throws:
IOException
-
-
Method Details
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
flushBuffer
- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
isModified
public boolean isModified()
-