Hi,

I've been trying to use LzoCodec to write a compressed file:

public class LzoTest {

   public static void main(String[] args) throws Exception {
      final LzoCodec codec = new LzoCodec();
      codec.setConf(new Configuration());
      final CompressionOutputStream out = codec.createOutputStream(new
FileOutputStream("test.lzo"));
      out.write("abc".getBytes());
      out.write("def".getBytes());
      out.close();
   }
}

I get the following output:

07/05/24 15:44:22 INFO util.NativeCodeLoader: Loaded the native-hadoop
library
07/05/24 15:44:22 INFO compress.LzoCodec: Successfully loaded &
initialized native-lzo library
Exception in thread "main" java.io.IOException: write beyond end of stream
        at
org.apache.hadoop.io.compress.BlockCompressorStream.write(BlockCompressorStream.java:68)
        at java.io.OutputStream.write(OutputStream.java:58)
        at no.trank.tI.LzoTest.main(LzoTest.java:19)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)

Isn't it possible to use LzoCodec for this purpose, or is this a bug?

- Espen

Reply via email to