[h2] Re: How to determine whether a file is H2 database?

2016-11-11 Thread Trig Chen
Answer my own question.

private static boolean isH2DbFile(final File file) {
if (!file.exists() || (file.length() < 1024)) {
return false;
}
try (final RandomAccessFile in = new RandomAccessFile(file, "r")) {
final byte[] headerBytes = new byte[20];
in.read(headerBytes);
final String header = new String(headerBytes);
if ((header.indexOf("H:2,blockSize:") == 0) // v1.4.x, no encryption
|| (header.indexOf("-- H2 0.5/B --") == 0) // v1.3.x
|| (header.indexOf("H2encryp") == 0) // v1.4.x, encrypted.
) {
in.close();
return true;
}
} catch (final Exception e) {
e.printStackTrace();
}
return false;
}


在 2016年11月8日星期二 UTC+8下午2:49:52,Trig Chen写道:
>
> Hi all,
>
> I used FilePathWrapper to remap H2 database file *.h2.db to *.xxx. 
> So come to the problem: Is there any API in H2  packages to determine 
> whether a file is H2 database?
>
> Best regards, 
> Trig Chen
>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] Is Java 7 the new H2 baseline Java version?

2016-11-11 Thread Noel Grandin

yup, we now need Java7 or better

--
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Is Java 7 the new H2 baseline Java version?

2016-11-11 Thread Steve McLeod
Hi all,

I might have missed this when announced or discussed, but I get the 
impression that we're no longer aiming for Java 6 compatibility as of H2 
1.4.193. Is that correct?

Regards,

Steve

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.