MCPcopy Index your code
hub / github.com/questdb/questdb / loadLib

Method loadLib

core/src/main/java/io/questdb/std/Os.java:181–207  ·  view source on GitHub ↗
(String lib, @NotNull InputStream libStream)

Source from the content-addressed store, hash-verified

179 }
180
181 public static void loadLib(String lib, @NotNull InputStream libStream) {
182 try {
183 File tempLib = null;
184 try {
185 int dot = lib.indexOf('.');
186 tempLib = File.createTempFile(lib.substring(0, dot), lib.substring(dot));
187 // copy to tempLib
188 try (FileOutputStream out = new FileOutputStream(tempLib)) {
189 byte[] buf = new byte[4096];
190 while (true) {
191 int read = libStream.read(buf);
192 if (read == -1) {
193 break;
194 }
195 out.write(buf, 0, read);
196 }
197 } finally {
198 tempLib.deleteOnExit();
199 }
200 System.load(tempLib.getAbsolutePath());
201 } catch (IOException e) {
202 throw new FatalError("Internal error: cannot unpack " + tempLib, e);
203 }
204 } finally {
205 Misc.free(libStream);
206 }
207 }
208
209 public static native long malloc(long size);
210

Callers 2

TestOsClass · 0.95
OsClass · 0.95

Calls 6

freeMethod · 0.95
createTempFileMethod · 0.80
indexOfMethod · 0.65
readMethod · 0.65
writeMethod · 0.65
loadMethod · 0.65

Tested by

no test coverage detected