@Override
public synchronized Path write( final Path path,
final byte[] bytes,
final Set<? extends OpenOption> options,
final FileAttribute<?>... attrs ) throws IllegalArgumentException, IOException, UnsupportedOperationException {
SeekableByteChannel byteChannel;
try {
byteChannel = newByteChannel( path, buildOptions( options ), attrs );
} catch ( final FileAlreadyExistsException ex ) {
( (AbstractPath) path ).clearCache();
byteChannel = newByteChannel( path, buildOptions( options, TRUNCATE_EXISTING ), attrs );
}
try {
byteChannel.write( ByteBuffer.wrap( bytes ) );
byteChannel.close();
} catch ( final java.io.IOException e ) {
throw new IOException( e );
}
return path;
}