1package IO::Uncompress::Bunzip2 ;
2
3use strict ;
4use warnings;
5use bytes;
6
7use IO::Compress::Base::Common 2.204 qw(:Status );
8
9use IO::Uncompress::Base 2.204 ;
10use IO::Uncompress::Adapter::Bunzip2 2.204 ;
11
12require Exporter ;
13our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS, $Bunzip2Error);
14
15$VERSION = '2.204';
16$Bunzip2Error = '';
17
18@ISA    = qw(IO::Uncompress::Base Exporter);
19@EXPORT_OK = qw( $Bunzip2Error bunzip2 ) ;
20#%EXPORT_TAGS = %IO::Uncompress::Base::EXPORT_TAGS ;
21push @{ $EXPORT_TAGS{all} }, @EXPORT_OK ;
22#Exporter::export_ok_tags('all');
23
24
25sub new
26{
27    my $class = shift ;
28    my $obj = IO::Compress::Base::Common::createSelfTiedObject($class, \$Bunzip2Error);
29
30    $obj->_create(undef, 0, @_);
31}
32
33sub bunzip2
34{
35    my $obj = IO::Compress::Base::Common::createSelfTiedObject(undef, \$Bunzip2Error);
36    return $obj->_inf(@_);
37}
38
39sub getExtraParams
40{
41    return (
42            'verbosity'     => [IO::Compress::Base::Common::Parse_boolean,   0],
43            'small'         => [IO::Compress::Base::Common::Parse_boolean,   0],
44        );
45}
46
47
48sub ckParams
49{
50    my $self = shift ;
51    my $got = shift ;
52
53    return 1;
54}
55
56sub mkUncomp
57{
58    my $self = shift ;
59    my $got = shift ;
60
61     my $magic = $self->ckMagic()
62        or return 0;
63
64    *$self->{Info} = $self->readHeader($magic)
65        or return undef ;
66
67    my $Small     = $got->getValue('small');
68    my $Verbosity = $got->getValue('verbosity');
69
70    my ($obj, $errstr, $errno) =  IO::Uncompress::Adapter::Bunzip2::mkUncompObject(
71                                                    $Small, $Verbosity);
72
73    return $self->saveErrorString(undef, $errstr, $errno)
74        if ! defined $obj;
75
76    *$self->{Uncomp} = $obj;
77
78    return 1;
79
80}
81
82
83sub ckMagic
84{
85    my $self = shift;
86
87    my $magic ;
88    $self->smartReadExact(\$magic, 4);
89
90    *$self->{HeaderPending} = $magic ;
91
92    return $self->HeaderError("Header size is " .
93                                        4 . " bytes")
94        if length $magic != 4;
95
96    return $self->HeaderError("Bad Magic.")
97        if ! isBzip2Magic($magic) ;
98
99
100    *$self->{Type} = 'bzip2';
101    return $magic;
102}
103
104sub readHeader
105{
106    my $self = shift;
107    my $magic = shift ;
108
109    $self->pushBack($magic);
110    *$self->{HeaderPending} = '';
111
112
113    return {
114        'Type'              => 'bzip2',
115        'FingerprintLength' => 4,
116        'HeaderLength'      => 4,
117        'TrailerLength'     => 0,
118        'Header'            => '$magic'
119        };
120
121}
122
123sub chkTrailer
124{
125    return STATUS_OK;
126}
127
128
129
130sub isBzip2Magic
131{
132    my $buffer = shift ;
133
134                  # ASCII:  B   Z   h    0    9
135    return $buffer =~ qr/^\x42\x5A\x68[\x30-\x39]$/;
136}
137
1381 ;
139
140__END__
141
142
143=head1 NAME
144
145IO::Uncompress::Bunzip2 - Read bzip2 files/buffers
146
147=head1 SYNOPSIS
148
149    use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
150
151    my $status = bunzip2 $input => $output [,OPTS]
152        or die "bunzip2 failed: $Bunzip2Error\n";
153
154    my $z = IO::Uncompress::Bunzip2->new( $input [OPTS] )
155        or die "bunzip2 failed: $Bunzip2Error\n";
156
157    $status = $z->read($buffer)
158    $status = $z->read($buffer, $length)
159    $status = $z->read($buffer, $length, $offset)
160    $line = $z->getline()
161    $char = $z->getc()
162    $char = $z->ungetc()
163    $char = $z->opened()
164
165    $data = $z->trailingData()
166    $status = $z->nextStream()
167    $data = $z->getHeaderInfo()
168    $z->tell()
169    $z->seek($position, $whence)
170    $z->binmode()
171    $z->fileno()
172    $z->eof()
173    $z->close()
174
175    $Bunzip2Error ;
176
177    # IO::File mode
178
179    <$z>
180    read($z, $buffer);
181    read($z, $buffer, $length);
182    read($z, $buffer, $length, $offset);
183    tell($z)
184    seek($z, $position, $whence)
185    binmode($z)
186    fileno($z)
187    eof($z)
188    close($z)
189
190=head1 DESCRIPTION
191
192This module provides a Perl interface that allows the reading of
193bzip2 files/buffers.
194
195For writing bzip2 files/buffers, see the companion module IO::Compress::Bzip2.
196
197=head1 Functional Interface
198
199A top-level function, C<bunzip2>, is provided to carry out
200"one-shot" uncompression between buffers and/or files. For finer
201control over the uncompression process, see the L</"OO Interface">
202section.
203
204    use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
205
206    bunzip2 $input_filename_or_reference => $output_filename_or_reference [,OPTS]
207        or die "bunzip2 failed: $Bunzip2Error\n";
208
209The functional interface needs Perl5.005 or better.
210
211=head2 bunzip2 $input_filename_or_reference => $output_filename_or_reference [, OPTS]
212
213C<bunzip2> expects at least two parameters,
214C<$input_filename_or_reference> and C<$output_filename_or_reference>
215and zero or more optional parameters (see L</Optional Parameters>)
216
217=head3 The C<$input_filename_or_reference> parameter
218
219The parameter, C<$input_filename_or_reference>, is used to define the
220source of the compressed data.
221
222It can take one of the following forms:
223
224=over 5
225
226=item A filename
227
228If the C<$input_filename_or_reference> parameter is a simple scalar, it is
229assumed to be a filename. This file will be opened for reading and the
230input data will be read from it.
231
232=item A filehandle
233
234If the C<$input_filename_or_reference> parameter is a filehandle, the input
235data will be read from it.  The string '-' can be used as an alias for
236standard input.
237
238=item A scalar reference
239
240If C<$input_filename_or_reference> is a scalar reference, the input data
241will be read from C<$$input_filename_or_reference>.
242
243=item An array reference
244
245If C<$input_filename_or_reference> is an array reference, each element in
246the array must be a filename.
247
248The input data will be read from each file in turn.
249
250The complete array will be walked to ensure that it only
251contains valid filenames before any data is uncompressed.
252
253=item An Input FileGlob string
254
255If C<$input_filename_or_reference> is a string that is delimited by the
256characters "<" and ">" C<bunzip2> will assume that it is an
257I<input fileglob string>. The input is the list of files that match the
258fileglob.
259
260See L<File::GlobMapper|File::GlobMapper> for more details.
261
262=back
263
264If the C<$input_filename_or_reference> parameter is any other type,
265C<undef> will be returned.
266
267=head3 The C<$output_filename_or_reference> parameter
268
269The parameter C<$output_filename_or_reference> is used to control the
270destination of the uncompressed data. This parameter can take one of
271these forms.
272
273=over 5
274
275=item A filename
276
277If the C<$output_filename_or_reference> parameter is a simple scalar, it is
278assumed to be a filename.  This file will be opened for writing and the
279uncompressed data will be written to it.
280
281=item A filehandle
282
283If the C<$output_filename_or_reference> parameter is a filehandle, the
284uncompressed data will be written to it.  The string '-' can be used as
285an alias for standard output.
286
287=item A scalar reference
288
289If C<$output_filename_or_reference> is a scalar reference, the
290uncompressed data will be stored in C<$$output_filename_or_reference>.
291
292=item An Array Reference
293
294If C<$output_filename_or_reference> is an array reference,
295the uncompressed data will be pushed onto the array.
296
297=item An Output FileGlob
298
299If C<$output_filename_or_reference> is a string that is delimited by the
300characters "<" and ">" C<bunzip2> will assume that it is an
301I<output fileglob string>. The output is the list of files that match the
302fileglob.
303
304When C<$output_filename_or_reference> is an fileglob string,
305C<$input_filename_or_reference> must also be a fileglob string. Anything
306else is an error.
307
308See L<File::GlobMapper|File::GlobMapper> for more details.
309
310=back
311
312If the C<$output_filename_or_reference> parameter is any other type,
313C<undef> will be returned.
314
315=head2 Notes
316
317When C<$input_filename_or_reference> maps to multiple compressed
318files/buffers and C<$output_filename_or_reference> is
319a single file/buffer, after uncompression C<$output_filename_or_reference> will contain a
320concatenation of all the uncompressed data from each of the input
321files/buffers.
322
323=head2 Optional Parameters
324
325The optional parameters for the one-shot function C<bunzip2>
326are (for the most part) identical to those used with the OO interface defined in the
327L</"Constructor Options"> section. The exceptions are listed below
328
329=over 5
330
331=item C<< AutoClose => 0|1 >>
332
333This option applies to any input or output data streams to
334C<bunzip2> that are filehandles.
335
336If C<AutoClose> is specified, and the value is true, it will result in all
337input and/or output filehandles being closed once C<bunzip2> has
338completed.
339
340This parameter defaults to 0.
341
342=item C<< BinModeOut => 0|1 >>
343
344This option is now a no-op. All files will be written  in binmode.
345
346=item C<< Append => 0|1 >>
347
348The behaviour of this option is dependent on the type of output data
349stream.
350
351=over 5
352
353=item * A Buffer
354
355If C<Append> is enabled, all uncompressed data will be append to the end of
356the output buffer. Otherwise the output buffer will be cleared before any
357uncompressed data is written to it.
358
359=item * A Filename
360
361If C<Append> is enabled, the file will be opened in append mode. Otherwise
362the contents of the file, if any, will be truncated before any uncompressed
363data is written to it.
364
365=item * A Filehandle
366
367If C<Append> is enabled, the filehandle will be positioned to the end of
368the file via a call to C<seek> before any uncompressed data is
369written to it.  Otherwise the file pointer will not be moved.
370
371=back
372
373When C<Append> is specified, and set to true, it will I<append> all uncompressed
374data to the output data stream.
375
376So when the output is a filehandle it will carry out a seek to the eof
377before writing any uncompressed data. If the output is a filename, it will be opened for
378appending. If the output is a buffer, all uncompressed data will be
379appended to the existing buffer.
380
381Conversely when C<Append> is not specified, or it is present and is set to
382false, it will operate as follows.
383
384When the output is a filename, it will truncate the contents of the file
385before writing any uncompressed data. If the output is a filehandle
386its position will not be changed. If the output is a buffer, it will be
387wiped before any uncompressed data is output.
388
389Defaults to 0.
390
391=item C<< MultiStream => 0|1 >>
392
393If the input file/buffer contains multiple compressed data streams, this
394option will uncompress the whole lot as a single data stream.
395
396Defaults to 0.
397
398=item C<< TrailingData => $scalar >>
399
400Returns the data, if any, that is present immediately after the compressed
401data stream once uncompression is complete.
402
403This option can be used when there is useful information immediately
404following the compressed data stream, and you don't know the length of the
405compressed data stream.
406
407If the input is a buffer, C<trailingData> will return everything from the
408end of the compressed data stream to the end of the buffer.
409
410If the input is a filehandle, C<trailingData> will return the data that is
411left in the filehandle input buffer once the end of the compressed data
412stream has been reached. You can then use the filehandle to read the rest
413of the input file.
414
415Don't bother using C<trailingData> if the input is a filename.
416
417If you know the length of the compressed data stream before you start
418uncompressing, you can avoid having to use C<trailingData> by setting the
419C<InputLength> option.
420
421=back
422
423=head2 Examples
424
425To read the contents of the file C<file1.txt.bz2> and write the
426uncompressed data to the file C<file1.txt>.
427
428    use strict ;
429    use warnings ;
430    use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
431
432    my $input = "file1.txt.bz2";
433    my $output = "file1.txt";
434    bunzip2 $input => $output
435        or die "bunzip2 failed: $Bunzip2Error\n";
436
437To read from an existing Perl filehandle, C<$input>, and write the
438uncompressed data to a buffer, C<$buffer>.
439
440    use strict ;
441    use warnings ;
442    use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
443    use IO::File ;
444
445    my $input = IO::File->new( "<file1.txt.bz2" )
446        or die "Cannot open 'file1.txt.bz2': $!\n" ;
447    my $buffer ;
448    bunzip2 $input => \$buffer
449        or die "bunzip2 failed: $Bunzip2Error\n";
450
451To uncompress all files in the directory "/my/home" that match "*.txt.bz2" and store the compressed data in the same directory
452
453    use strict ;
454    use warnings ;
455    use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
456
457    bunzip2 '</my/home/*.txt.bz2>' => '</my/home/#1.txt>'
458        or die "bunzip2 failed: $Bunzip2Error\n";
459
460and if you want to compress each file one at a time, this will do the trick
461
462    use strict ;
463    use warnings ;
464    use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
465
466    for my $input ( glob "/my/home/*.txt.bz2" )
467    {
468        my $output = $input;
469        $output =~ s/.bz2// ;
470        bunzip2 $input => $output
471            or die "Error compressing '$input': $Bunzip2Error\n";
472    }
473
474=head1 OO Interface
475
476=head2 Constructor
477
478The format of the constructor for IO::Uncompress::Bunzip2 is shown below
479
480    my $z = IO::Uncompress::Bunzip2->new( $input [OPTS] )
481        or die "IO::Uncompress::Bunzip2 failed: $Bunzip2Error\n";
482
483Returns an C<IO::Uncompress::Bunzip2> object on success and undef on failure.
484The variable C<$Bunzip2Error> will contain an error message on failure.
485
486If you are running Perl 5.005 or better the object, C<$z>, returned from
487IO::Uncompress::Bunzip2 can be used exactly like an L<IO::File|IO::File> filehandle.
488This means that all normal input file operations can be carried out with
489C<$z>.  For example, to read a line from a compressed file/buffer you can
490use either of these forms
491
492    $line = $z->getline();
493    $line = <$z>;
494
495The mandatory parameter C<$input> is used to determine the source of the
496compressed data. This parameter can take one of three forms.
497
498=over 5
499
500=item A filename
501
502If the C<$input> parameter is a scalar, it is assumed to be a filename. This
503file will be opened for reading and the compressed data will be read from it.
504
505=item A filehandle
506
507If the C<$input> parameter is a filehandle, the compressed data will be
508read from it.
509The string '-' can be used as an alias for standard input.
510
511=item A scalar reference
512
513If C<$input> is a scalar reference, the compressed data will be read from
514C<$$input>.
515
516=back
517
518=head2 Constructor Options
519
520The option names defined below are case insensitive and can be optionally
521prefixed by a '-'.  So all of the following are valid
522
523    -AutoClose
524    -autoclose
525    AUTOCLOSE
526    autoclose
527
528OPTS is a combination of the following options:
529
530=over 5
531
532=item C<< AutoClose => 0|1 >>
533
534This option is only valid when the C<$input> parameter is a filehandle. If
535specified, and the value is true, it will result in the file being closed once
536either the C<close> method is called or the IO::Uncompress::Bunzip2 object is
537destroyed.
538
539This parameter defaults to 0.
540
541=item C<< MultiStream => 0|1 >>
542
543Allows multiple concatenated compressed streams to be treated as a single
544compressed stream. Decompression will stop once either the end of the
545file/buffer is reached, an error is encountered (premature eof, corrupt
546compressed data) or the end of a stream is not immediately followed by the
547start of another stream.
548
549This parameter defaults to 0.
550
551=item C<< Prime => $string >>
552
553This option will uncompress the contents of C<$string> before processing the
554input file/buffer.
555
556This option can be useful when the compressed data is embedded in another
557file/data structure and it is not possible to work out where the compressed
558data begins without having to read the first few bytes. If this is the
559case, the uncompression can be I<primed> with these bytes using this
560option.
561
562=item C<< Transparent => 0|1 >>
563
564If this option is set and the input file/buffer is not compressed data,
565the module will allow reading of it anyway.
566
567In addition, if the input file/buffer does contain compressed data and
568there is non-compressed data immediately following it, setting this option
569will make this module treat the whole file/buffer as a single data stream.
570
571This option defaults to 1.
572
573=item C<< BlockSize => $num >>
574
575When reading the compressed input data, IO::Uncompress::Bunzip2 will read it in
576blocks of C<$num> bytes.
577
578This option defaults to 4096.
579
580=item C<< InputLength => $size >>
581
582When present this option will limit the number of compressed bytes read
583from the input file/buffer to C<$size>. This option can be used in the
584situation where there is useful data directly after the compressed data
585stream and you know beforehand the exact length of the compressed data
586stream.
587
588This option is mostly used when reading from a filehandle, in which case
589the file pointer will be left pointing to the first byte directly after the
590compressed data stream.
591
592This option defaults to off.
593
594=item C<< Append => 0|1 >>
595
596This option controls what the C<read> method does with uncompressed data.
597
598If set to 1, all uncompressed data will be appended to the output parameter
599of the C<read> method.
600
601If set to 0, the contents of the output parameter of the C<read> method
602will be overwritten by the uncompressed data.
603
604Defaults to 0.
605
606=item C<< Strict => 0|1 >>
607
608This option is a no-op.
609
610=item C<< Small => 0|1 >>
611
612When non-zero this options will make bzip2 use a decompression algorithm
613that uses less memory at the expense of increasing the amount of time
614taken for decompression.
615
616Default is 0.
617
618=back
619
620=head2 Examples
621
622TODO
623
624=head1 Methods
625
626=head2 read
627
628Usage is
629
630    $status = $z->read($buffer)
631
632Reads a block of compressed data (the size of the compressed block is
633determined by the C<Buffer> option in the constructor), uncompresses it and
634writes any uncompressed data into C<$buffer>. If the C<Append> parameter is
635set in the constructor, the uncompressed data will be appended to the
636C<$buffer> parameter. Otherwise C<$buffer> will be overwritten.
637
638Returns the number of uncompressed bytes written to C<$buffer>, zero if eof
639or a negative number on error.
640
641=head2 read
642
643Usage is
644
645    $status = $z->read($buffer, $length)
646    $status = $z->read($buffer, $length, $offset)
647
648    $status = read($z, $buffer, $length)
649    $status = read($z, $buffer, $length, $offset)
650
651Attempt to read C<$length> bytes of uncompressed data into C<$buffer>.
652
653The main difference between this form of the C<read> method and the
654previous one, is that this one will attempt to return I<exactly> C<$length>
655bytes. The only circumstances that this function will not is if end-of-file
656or an IO error is encountered.
657
658Returns the number of uncompressed bytes written to C<$buffer>, zero if eof
659or a negative number on error.
660
661=head2 getline
662
663Usage is
664
665    $line = $z->getline()
666    $line = <$z>
667
668Reads a single line.
669
670This method fully supports the use of the variable C<$/> (or
671C<$INPUT_RECORD_SEPARATOR> or C<$RS> when C<English> is in use) to
672determine what constitutes an end of line. Paragraph mode, record mode and
673file slurp mode are all supported.
674
675=head2 getc
676
677Usage is
678
679    $char = $z->getc()
680
681Read a single character.
682
683=head2 ungetc
684
685Usage is
686
687    $char = $z->ungetc($string)
688
689=head2 getHeaderInfo
690
691Usage is
692
693    $hdr  = $z->getHeaderInfo();
694    @hdrs = $z->getHeaderInfo();
695
696This method returns either a hash reference (in scalar context) or a list
697or hash references (in array context) that contains information about each
698of the header fields in the compressed data stream(s).
699
700=head2 tell
701
702Usage is
703
704    $z->tell()
705    tell $z
706
707Returns the uncompressed file offset.
708
709=head2 eof
710
711Usage is
712
713    $z->eof();
714    eof($z);
715
716Returns true if the end of the compressed input stream has been reached.
717
718=head2 seek
719
720    $z->seek($position, $whence);
721    seek($z, $position, $whence);
722
723Provides a sub-set of the C<seek> functionality, with the restriction
724that it is only legal to seek forward in the input file/buffer.
725It is a fatal error to attempt to seek backward.
726
727Note that the implementation of C<seek> in this module does not provide
728true random access to a compressed file/buffer. It  works by uncompressing
729data from the current offset in the file/buffer until it reaches the
730uncompressed offset specified in the parameters to C<seek>. For very small
731files this may be acceptable behaviour. For large files it may cause an
732unacceptable delay.
733
734The C<$whence> parameter takes one the usual values, namely SEEK_SET,
735SEEK_CUR or SEEK_END.
736
737Returns 1 on success, 0 on failure.
738
739=head2 binmode
740
741Usage is
742
743    $z->binmode
744    binmode $z ;
745
746This is a noop provided for completeness.
747
748=head2 opened
749
750    $z->opened()
751
752Returns true if the object currently refers to a opened file/buffer.
753
754=head2 autoflush
755
756    my $prev = $z->autoflush()
757    my $prev = $z->autoflush(EXPR)
758
759If the C<$z> object is associated with a file or a filehandle, this method
760returns the current autoflush setting for the underlying filehandle. If
761C<EXPR> is present, and is non-zero, it will enable flushing after every
762write/print operation.
763
764If C<$z> is associated with a buffer, this method has no effect and always
765returns C<undef>.
766
767B<Note> that the special variable C<$|> B<cannot> be used to set or
768retrieve the autoflush setting.
769
770=head2 input_line_number
771
772    $z->input_line_number()
773    $z->input_line_number(EXPR)
774
775Returns the current uncompressed line number. If C<EXPR> is present it has
776the effect of setting the line number. Note that setting the line number
777does not change the current position within the file/buffer being read.
778
779The contents of C<$/> are used to determine what constitutes a line
780terminator.
781
782=head2 fileno
783
784    $z->fileno()
785    fileno($z)
786
787If the C<$z> object is associated with a file or a filehandle, C<fileno>
788will return the underlying file descriptor. Once the C<close> method is
789called C<fileno> will return C<undef>.
790
791If the C<$z> object is associated with a buffer, this method will return
792C<undef>.
793
794=head2 close
795
796    $z->close() ;
797    close $z ;
798
799Closes the output file/buffer.
800
801For most versions of Perl this method will be automatically invoked if
802the IO::Uncompress::Bunzip2 object is destroyed (either explicitly or by the
803variable with the reference to the object going out of scope). The
804exceptions are Perl versions 5.005 through 5.00504 and 5.8.0. In
805these cases, the C<close> method will be called automatically, but
806not until global destruction of all live objects when the program is
807terminating.
808
809Therefore, if you want your scripts to be able to run on all versions
810of Perl, you should call C<close> explicitly and not rely on automatic
811closing.
812
813Returns true on success, otherwise 0.
814
815If the C<AutoClose> option has been enabled when the IO::Uncompress::Bunzip2
816object was created, and the object is associated with a file, the
817underlying file will also be closed.
818
819=head2 nextStream
820
821Usage is
822
823    my $status = $z->nextStream();
824
825Skips to the next compressed data stream in the input file/buffer. If a new
826compressed data stream is found, the eof marker will be cleared and C<$.>
827will be reset to 0.
828
829Returns 1 if a new stream was found, 0 if none was found, and -1 if an
830error was encountered.
831
832=head2 trailingData
833
834Usage is
835
836    my $data = $z->trailingData();
837
838Returns the data, if any, that is present immediately after the compressed
839data stream once uncompression is complete. It only makes sense to call
840this method once the end of the compressed data stream has been
841encountered.
842
843This option can be used when there is useful information immediately
844following the compressed data stream, and you don't know the length of the
845compressed data stream.
846
847If the input is a buffer, C<trailingData> will return everything from the
848end of the compressed data stream to the end of the buffer.
849
850If the input is a filehandle, C<trailingData> will return the data that is
851left in the filehandle input buffer once the end of the compressed data
852stream has been reached. You can then use the filehandle to read the rest
853of the input file.
854
855Don't bother using C<trailingData> if the input is a filename.
856
857If you know the length of the compressed data stream before you start
858uncompressing, you can avoid having to use C<trailingData> by setting the
859C<InputLength> option in the constructor.
860
861=head1 Importing
862
863No symbolic constants are required by IO::Uncompress::Bunzip2 at present.
864
865=over 5
866
867=item :all
868
869Imports C<bunzip2> and C<$Bunzip2Error>.
870Same as doing this
871
872    use IO::Uncompress::Bunzip2 qw(bunzip2 $Bunzip2Error) ;
873
874=back
875
876=head1 EXAMPLES
877
878=head2 Working with Net::FTP
879
880See L<IO::Compress::FAQ|IO::Compress::FAQ/"Compressed files and Net::FTP">
881
882=head1 SUPPORT
883
884General feedback/questions/bug reports should be sent to
885L<https://github.com/pmqs/IO-Compress/issues> (preferred) or
886L<https://rt.cpan.org/Public/Dist/Display.html?Name=IO-Compress>.
887
888=head1 SEE ALSO
889
890L<Compress::Zlib>, L<IO::Compress::Gzip>, L<IO::Uncompress::Gunzip>, L<IO::Compress::Deflate>, L<IO::Uncompress::Inflate>, L<IO::Compress::RawDeflate>, L<IO::Uncompress::RawInflate>, L<IO::Compress::Bzip2>, L<IO::Compress::Lzma>, L<IO::Uncompress::UnLzma>, L<IO::Compress::Xz>, L<IO::Uncompress::UnXz>, L<IO::Compress::Lzip>, L<IO::Uncompress::UnLzip>, L<IO::Compress::Lzop>, L<IO::Uncompress::UnLzop>, L<IO::Compress::Lzf>, L<IO::Uncompress::UnLzf>, L<IO::Compress::Zstd>, L<IO::Uncompress::UnZstd>, L<IO::Uncompress::AnyInflate>, L<IO::Uncompress::AnyUncompress>
891
892L<IO::Compress::FAQ|IO::Compress::FAQ>
893
894L<File::GlobMapper|File::GlobMapper>, L<Archive::Zip|Archive::Zip>,
895L<Archive::Tar|Archive::Tar>,
896L<IO::Zlib|IO::Zlib>
897
898The primary site for the bzip2 program is L<https://sourceware.org/bzip2/>.
899
900See the module L<Compress::Bzip2|Compress::Bzip2>
901
902=head1 AUTHOR
903
904This module was written by Paul Marquess, C<pmqs@cpan.org>.
905
906=head1 MODIFICATION HISTORY
907
908See the Changes file.
909
910=head1 COPYRIGHT AND LICENSE
911
912Copyright (c) 2005-2023 Paul Marquess. All rights reserved.
913
914This program is free software; you can redistribute it and/or
915modify it under the same terms as Perl itself.
916