From aff602b502ad7f24dc7501e80dee9a5267364bda Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Tue, 2 Dec 2014 21:20:53 +0100 Subject: [PATCH] Override write(byte[] b, int off, int len) in FilterOutputStream for better performance Closes #8748 --- .../elasticsearch/common/blobstore/fs/FsBlobContainer.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/elasticsearch/common/blobstore/fs/FsBlobContainer.java b/src/main/java/org/elasticsearch/common/blobstore/fs/FsBlobContainer.java index 0e331a55b2460..e1f0770a9e5e3 100644 --- a/src/main/java/org/elasticsearch/common/blobstore/fs/FsBlobContainer.java +++ b/src/main/java/org/elasticsearch/common/blobstore/fs/FsBlobContainer.java @@ -83,6 +83,10 @@ public InputStream openInput(String name) throws IOException { public OutputStream createOutput(String blobName) throws IOException { final File file = new File(path, blobName); return new BufferedOutputStream(new FilterOutputStream(new FileOutputStream(file)) { + + @Override // FilterOutputStream#write(byte[] b, int off, int len) is trappy writes every single byte + public void write(byte[] b, int off, int len) throws IOException { out.write(b, off, len);} + @Override public void close() throws IOException { super.close();