class EDI::Bzip2Reader
A
simple utility class that fills a need not covered by “zlib”.
It is stripped to the essentials needed here internally. Not recommended for general use! The overhead of starting “bzcat” processes all the time is considerable, binding to a library similar to ‘zib’ for the BZIP2 format would give much better results.
Attributes
path[RW]
Public Class Methods
new( hnd )
click to toggle source
# File lib/edi4r.rb, line 185 def initialize( hnd ) @path = hnd.path @pipe = IO.popen("bzcat #@path",'r' ) end
Public Instance Methods
close()
click to toggle source
# File lib/edi4r.rb, line 203 def close @pipe.close end
getc()
click to toggle source
# File lib/edi4r.rb, line 194 def getc @pipe.getc # @pipe.read( 1 ) end
read( len=0 )
click to toggle source
# File lib/edi4r.rb, line 190 def read( len=0 ) len==0 ? @pipe.read : @pipe.read( len ) end
rewind()
click to toggle source
# File lib/edi4r.rb, line 198 def rewind @pipe.close @pipe = IO.popen("bzcat #@path",'r' ) end