1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
//
// Copyright 2020 FoxyUtils ehf. All rights reserved.
//
// This is a commercial product and requires a license to operate.
// A trial license can be obtained at https://unidoc.io
//
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
//
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/
package jbig2 ;import (_d "github.com/unidoc/unipdf/v4/internal/bitwise";_gd "github.com/unidoc/unipdf/v4/internal/jbig2/decoder";_ee "github.com/unidoc/unipdf/v4/internal/jbig2/document";_af "github.com/unidoc/unipdf/v4/internal/jbig2/document/segments";
_e "github.com/unidoc/unipdf/v4/internal/jbig2/errors";_a "sort";);func DecodeBytes (encoded []byte ,parameters _gd .Parameters ,globals ...Globals )([]byte ,error ){var _gf Globals ;if len (globals )> 0{_gf =globals [0];};_c ,_f :=_gd .Decode (encoded ,parameters ,_gf .ToDocumentGlobals ());
if _f !=nil {return nil ,_f ;};return _c .DecodeNextPage ();};func DecodeGlobals (encoded []byte )(Globals ,error ){const _fd ="\u0044\u0065\u0063\u006f\u0064\u0065\u0047\u006c\u006f\u0062\u0061\u006c\u0073";_ga :=_d .NewReader (encoded );_gdg ,_ea :=_ee .DecodeDocument (_ga ,nil );
if _ea !=nil {return nil ,_e .Wrap (_ea ,_fd ,"");};if _gdg .GlobalSegments ==nil ||(_gdg .GlobalSegments .Segments ==nil ){return nil ,_e .Error (_fd ,"\u006eo\u0020\u0067\u006c\u006f\u0062\u0061\u006c\u0020\u0073\u0065\u0067m\u0065\u006e\u0074\u0073\u0020\u0066\u006f\u0075\u006e\u0064");
};_cg :=Globals {};for _ ,_cd :=range _gdg .GlobalSegments .Segments {_cg [int (_cd .SegmentNumber )]=_cd ;};return _cg ,nil ;};type Globals map[int ]*_af .Header ;func (_de Globals )ToDocumentGlobals ()*_ee .Globals {if _de ==nil {return nil ;};_b :=[]*_af .Header {};
for _ ,_gb :=range _de {_b =append (_b ,_gb );};_a .Slice (_b ,func (_ad ,_ed int )bool {return _b [_ad ].SegmentNumber < _b [_ed ].SegmentNumber });return &_ee .Globals {Segments :_b };};
|