Index: lucene/core/src/java/org/apache/lucene/codecs/BlockTreeTermsReader.java
===================================================================
--- lucene/core/src/java/org/apache/lucene/codecs/BlockTreeTermsReader.java	(révision 1436266)
+++ lucene/core/src/java/org/apache/lucene/codecs/BlockTreeTermsReader.java	(copie de travail)
@@ -27,6 +27,7 @@
 import java.util.Locale;
 import java.util.TreeMap;
 
+import org.apache.lucene.codecs.compressing.LZ4;
 import org.apache.lucene.index.CorruptIndexException;
 import org.apache.lucene.index.DocsAndPositionsEnum;
 import org.apache.lucene.index.DocsEnum;
@@ -712,7 +713,9 @@
           if (suffixBytes.length < numBytes) {
             suffixBytes = new byte[ArrayUtil.oversize(numBytes, 1)];
           }
-          in.readBytes(suffixBytes, 0, numBytes);
+          //in.readBytes(suffixBytes, 0, numBytes);
+          final int decompressedLen = LZ4.decompress(in, numBytes, suffixBytes, 0);
+          if (decompressedLen != numBytes) throw new IOException();
           suffixesReader.reset(suffixBytes, 0, numBytes);
 
           // stats
@@ -2372,8 +2375,11 @@
           if (suffixBytes.length < numBytes) {
             suffixBytes = new byte[ArrayUtil.oversize(numBytes, 1)];
           }
-          in.readBytes(suffixBytes, 0, numBytes);
+          //in.readBytes(suffixBytes, 0, numBytes);
+          final int decompressedLen = LZ4.decompress(in, numBytes, suffixBytes, 0);
+          if (decompressedLen != numBytes) throw new IOException();
           suffixesReader.reset(suffixBytes, 0, numBytes);
+          suffixesReader.reset(suffixBytes, 0, numBytes);
 
           /*if (DEBUG) {
             if (arc == null) {
Index: lucene/core/src/java/org/apache/lucene/codecs/BlockTreeTermsWriter.java
===================================================================
--- lucene/core/src/java/org/apache/lucene/codecs/BlockTreeTermsWriter.java	(révision 1436266)
+++ lucene/core/src/java/org/apache/lucene/codecs/BlockTreeTermsWriter.java	(copie de travail)
@@ -22,6 +22,8 @@
 import java.util.Comparator;
 import java.util.List;
 
+import org.apache.lucene.codecs.compressing.GrowableByteArrayDataOutput;
+import org.apache.lucene.codecs.compressing.LZ4;
 import org.apache.lucene.index.FieldInfo.IndexOptions;
 import org.apache.lucene.index.FieldInfo;
 import org.apache.lucene.index.FieldInfos;
@@ -921,9 +923,12 @@
       // search on lookup
 
       // Write suffixes byte[] blob to terms dict output:
-      out.writeVInt((int) (bytesWriter.getFilePointer() << 1) | (isLeafBlock ? 1:0));
+      /*out.writeVInt((int) (bytesWriter.getFilePointer() << 1) | (isLeafBlock ? 1:0));
       bytesWriter.writeTo(out);
-      bytesWriter.reset();
+      bytesWriter.reset();*/
+      out.writeVInt((int) (bytesWriter.length << 1) | (isLeafBlock ? 1:0));
+      LZ4.compressHC(bytesWriter.bytes, 0, bytesWriter.length, out);
+      bytesWriter.length = 0;
 
       // Write term stats byte[] blob
       out.writeVInt((int) bytesWriter2.getFilePointer());
@@ -1046,7 +1051,7 @@
       }
     }
 
-    private final RAMOutputStream bytesWriter = new RAMOutputStream();
+    private final GrowableByteArrayDataOutput bytesWriter = new GrowableByteArrayDataOutput(256);
     private final RAMOutputStream bytesWriter2 = new RAMOutputStream();
   }
 
Index: lucene/core/src/java/org/apache/lucene/codecs/compressing/GrowableByteArrayDataOutput.java
===================================================================
--- lucene/core/src/java/org/apache/lucene/codecs/compressing/GrowableByteArrayDataOutput.java	(révision 1436266)
+++ lucene/core/src/java/org/apache/lucene/codecs/compressing/GrowableByteArrayDataOutput.java	(copie de travail)
@@ -25,12 +25,12 @@
 /**
  * A {@link DataOutput} that can be used to build a byte[].
  */
-final class GrowableByteArrayDataOutput extends DataOutput {
+public final class GrowableByteArrayDataOutput extends DataOutput {
 
-  byte[] bytes;
-  int length;
+  public byte[] bytes;
+  public int length;
 
-  GrowableByteArrayDataOutput(int cp) {
+  public GrowableByteArrayDataOutput(int cp) {
     this.bytes = new byte[ArrayUtil.oversize(cp, 1)];
     this.length = 0;
   }
Index: lucene/core/src/java/org/apache/lucene/codecs/compressing/LZ4.java
===================================================================
--- lucene/core/src/java/org/apache/lucene/codecs/compressing/LZ4.java	(révision 1436266)
+++ lucene/core/src/java/org/apache/lucene/codecs/compressing/LZ4.java	(copie de travail)
@@ -30,7 +30,7 @@
  * http://code.google.com/p/lz4/
  * http://fastcompression.blogspot.fr/p/lz4.html
  */
-class LZ4 {
+public class LZ4 {
 
   private LZ4() {}
 
