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 FileChannel
private boolean
private final Path
private ByteBuffer
private ByteBuffer
-
Constructor Summary
ConstructorsConstructorDescriptionCachingOutputStream
(File path) CachingOutputStream
(Path path) CachingOutputStream
(Path path, int bufferSize) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
flush()
private void
flushBuffer
(ByteBuffer writeBuffer) boolean
void
write
(byte[] b) void
write
(byte[] b, int off, int len) void
write
(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:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
flushBuffer
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
isModified
public boolean isModified()
-