70
71 // State for progress bar:
72 private long _byteCount; // bytes read in current segment
73 private int _segCount; // number of segs scanned
74 private int _fileCount; // number of files written
75 private long _estByteLimit; // estimate of eventual total
76 private int _estSegLimit; // ditto
77 private int _estFileLimit; // ditto
78 private int _prevPercent = -1; // for monotonicity
79
80 private final CRC32 _crc32 = new CRC32();
81 private byte[] _buf = new byte[1<<14];
82
83 private UnpackerImpl _p200;
84 private PropMap _props;
85
86 static {
87 // If loading from stand alone build uncomment this.
88 // System.loadLibrary("unpack");
89 java.security.AccessController.doPrivileged(
90 new sun.security.action.LoadLibraryAction("unpack"));
91 initIDs();
92 }
93
94 NativeUnpack(UnpackerImpl p200) {
95 super();
96 _p200 = p200;
97 _props = p200.props;
98 p200._nunp = this;
99 }
100
101 // for JNI callbacks
102 static private Object currentInstance() {
103 UnpackerImpl p200 = (UnpackerImpl) Utils.getTLGlobals();
104 return (p200 == null)? null: p200._nunp;
105 }
106
107 // Callback from the unpacker engine to get more data.
108 private long readInputFn(ByteBuffer pbuf, long minlen) throws IOException {
109 if (in == null) return 0; // nothing is readable
110 long maxlen = pbuf.capacity() - pbuf.position();
|
70
71 // State for progress bar:
72 private long _byteCount; // bytes read in current segment
73 private int _segCount; // number of segs scanned
74 private int _fileCount; // number of files written
75 private long _estByteLimit; // estimate of eventual total
76 private int _estSegLimit; // ditto
77 private int _estFileLimit; // ditto
78 private int _prevPercent = -1; // for monotonicity
79
80 private final CRC32 _crc32 = new CRC32();
81 private byte[] _buf = new byte[1<<14];
82
83 private UnpackerImpl _p200;
84 private PropMap _props;
85
86 static {
87 // If loading from stand alone build uncomment this.
88 // System.loadLibrary("unpack");
89 java.security.AccessController.doPrivileged(
90 new java.security.PrivilegedAction<Void>() {
91 public Void run() {
92 System.loadLibrary("unpack");
93 return null;
94 }
95 });
96 initIDs();
97 }
98
99 NativeUnpack(UnpackerImpl p200) {
100 super();
101 _p200 = p200;
102 _props = p200.props;
103 p200._nunp = this;
104 }
105
106 // for JNI callbacks
107 static private Object currentInstance() {
108 UnpackerImpl p200 = (UnpackerImpl) Utils.getTLGlobals();
109 return (p200 == null)? null: p200._nunp;
110 }
111
112 // Callback from the unpacker engine to get more data.
113 private long readInputFn(ByteBuffer pbuf, long minlen) throws IOException {
114 if (in == null) return 0; // nothing is readable
115 long maxlen = pbuf.capacity() - pbuf.position();
|