Hi,
I tried to copy an sqlite database (a normal text file) out of my *.jar file. The database is in my java project as a resource file. I read every byte and store it directly into the new file, but somewhow it changes 4 Bytes to 65533! The correct values are 2 times 129 and 2 times 144. It's really strange!
Have you an idea why this happens? Or is there a better way how to copy out a resource file?
Thank you for your answers.
URL u = this.getClass().getResource("/database/resources/mydb.sqlite");
try {
InputStreamReader in = new InputStreamReader(u.openStream());
File outputFile = new File("newdb.sqlite");
FileWriter out = new FileWriter(outputFile);
BufferedWriter writer = new BufferedWriter(out);
while ((c = in.read()) != -1) {
writer.write(c);
}
in.close();
writer.close();
} catch(Exception e) {
jErrorFld.setText(e.toString());
}