Espen,

On Thu, May 24, 2007 at 03:49:38PM +0200, Espen Amble Kolstad wrote:
>Hi,
>
>I've been trying to use LzoCodec to write a compressed file:
>

Could you try this command:
$ bin/hadoop jar build/hadoop-0.12.4-dev-test.jar testsequencefile -seed 0 
-count 10000 -compressType RECORD blah.seq -codec 
org.apache.hadoop.io.compress.LzoCodec -check

LzoCodec seems to work fine for me... maybe your FileOutputStream was somehow 
corrupted?

thanks,
Arun

>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