public void doLoad() { if (loaded) { return; } final long startTime = System.currentTimeMillis(); File tempDir = Files.createTempDir(); tempDir.deleteOnExit(); File extractedLibraryPath = new File(tempDir, getLibName()); try (FileOutputStream outputStream = new FileOutputStream(extractedLibraryPath)) { getLibraryByteSource().copyTo(outputStream); } catch (IOException e) { throw new RuntimeException("Cannot extract SQLite library into " + extractedLibraryPath, e); } loadFromDirectory(tempDir); logWithTime("SQLite natives prepared in", startTime); }
private void extractAndLoad(final InputStream input, final File output) { File libPath = output.getParentFile(); if (!libPath.exists() && !libPath.mkdirs()) { throw new RuntimeException("could not create " + libPath); } FileOutputStream outputStream = null; try { outputStream = new FileOutputStream(output); copy(input, outputStream); } catch (IOException e) { throw new RuntimeException("Cannot extractAndLoad SQLite library into " + output, e); } finally { closeQuietly(outputStream); closeQuietly(input); } loadFromDirectory(libPath); }
private void extractAndLoad(final InputStream input, final File output) { File libPath = output.getParentFile(); if (!libPath.exists() && !libPath.mkdirs()) { throw new RuntimeException("could not create " + libPath); } FileOutputStream outputStream = null; try { outputStream = new FileOutputStream(output); copy(input, outputStream); } catch (IOException e) { throw new RuntimeException("Cannot extractAndLoad SQLite library into " + output, e); } finally { closeQuietly(outputStream); closeQuietly(input); } loadFromDirectory(libPath); }
private void extractAndLoad(final InputStream input, final File output) { File libPath = output.getParentFile(); if (!libPath.exists() && !libPath.mkdirs()) { throw new RuntimeException("could not create " + libPath); } FileOutputStream outputStream = null; try { outputStream = new FileOutputStream(output); copy(input, outputStream); } catch (IOException e) { throw new RuntimeException("Cannot extractAndLoad SQLite library into " + output, e); } finally { closeQuietly(outputStream); closeQuietly(input); } loadFromDirectory(libPath); }
public void doLoad() { if (loaded) { return; } final long startTime = System.currentTimeMillis(); File tempDir = Files.createTempDir(); tempDir.deleteOnExit(); File extractedLibraryPath = new File(tempDir, getLibName()); try (FileOutputStream outputStream = new FileOutputStream(extractedLibraryPath)) { getLibraryByteSource().copyTo(outputStream); } catch (IOException e) { throw new RuntimeException("Cannot extract SQLite library into " + extractedLibraryPath, e); } loadFromDirectory(tempDir); logWithTime("SQLite natives prepared in", startTime); }
public void doLoad() { if (loaded) { return; } final long startTime = System.currentTimeMillis(); final File extractedLibrary = getNativeLibraryPath(); if (isExtractedLibUptodate(extractedLibrary)) { loadFromDirectory(extractedLibrary.getParentFile()); } else { extractAndLoad(getLibraryStream(), extractedLibrary); } logWithTime("SQLite natives prepared in", startTime); }
public void doLoad() { if (loaded) { return; } final long startTime = System.currentTimeMillis(); final File extractedLibrary = getNativeLibraryPath(); if (isExtractedLibUptodate(extractedLibrary)) { loadFromDirectory(extractedLibrary.getParentFile()); } else { extractAndLoad(getLibraryStream(), extractedLibrary); } logWithTime("SQLite natives prepared in", startTime); }
public void doLoad() { if (loaded) { return; } final long startTime = System.currentTimeMillis(); final File extractedLibrary = getNativeLibraryPath(); if (isExtractedLibUptodate(extractedLibrary)) { loadFromDirectory(extractedLibrary.getParentFile()); } else { extractAndLoad(getLibraryStream(), extractedLibrary); } logWithTime("SQLite natives prepared in", startTime); }