use of com.ramussoft.database.MemoryDatabase in project ramus by Vitaliy-Yakovchuk.
the class InternetServer method loadAllData.
public byte[] loadAllData() {
synchronized (saveLock) {
MemoryDatabase database = new MemoryDatabase() {
@Override
protected void loadSuits(List<PluginProvider> suits) {
suits.addAll(engineFactory.getSuits());
}
@Override
protected File getFile() {
return null;
}
@Override
public Connection createConnection() throws SQLException {
return engineFactory.createConnection();
}
@Override
protected String getJournalDirectoryName(String tmp) {
return null;
}
@Override
protected FileIEngineImpl createFileIEngine(PluginFactory factory) throws ClassNotFoundException, ZipException, IOException {
return new FileIEngineImpl(0, template, factory, null);
}
};
Engine s = database.getEngine(null);
FileIEngineImpl impl = (FileIEngineImpl) s.getDeligate();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
ZipOutputStream out;
try {
out = impl.writeToStream(stream);
out.close();
return stream.toByteArray();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
Aggregations