*.suo
*.user
/bin
+/bindings/Java/wrapper/bin
/bindings/Microsoft.NET/MHashDotNet384.Example/obj
/bindings/Microsoft.NET/MHashDotNet384.Wrapper/obj
/bindings/Microsoft.NET/bin
--- /dev/null
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.24720.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MHashJava384", "MHashJava384.vcxproj", "{98971AF0-1B4D-4B5A-A174-9B099F7977B8}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {98971AF0-1B4D-4B5A-A174-9B099F7977B8}.Debug|x64.ActiveCfg = Debug|x64
+ {98971AF0-1B4D-4B5A-A174-9B099F7977B8}.Debug|x64.Build.0 = Debug|x64
+ {98971AF0-1B4D-4B5A-A174-9B099F7977B8}.Debug|x86.ActiveCfg = Debug|Win32
+ {98971AF0-1B4D-4B5A-A174-9B099F7977B8}.Debug|x86.Build.0 = Debug|Win32
+ {98971AF0-1B4D-4B5A-A174-9B099F7977B8}.Release|x64.ActiveCfg = Release|x64
+ {98971AF0-1B4D-4B5A-A174-9B099F7977B8}.Release|x64.Build.0 = Release|x64
+ {98971AF0-1B4D-4B5A-A174-9B099F7977B8}.Release|x86.ActiveCfg = Release|Win32
+ {98971AF0-1B4D-4B5A-A174-9B099F7977B8}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="src\dllmain.cpp" />
+ <ClCompile Include="src\MHashJava384.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="include\mhash_384.jni.h" />
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{98971AF0-1B4D-4B5A-A174-9B099F7977B8}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>MHashJava384</RootNamespace>
+ <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v140_xp</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v140_xp</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v140_xp</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v140_xp</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(SolutionDir)\bin\$(PlatformShortName)\$(Configuration)\</OutDir>
+ <IntDir>$(SolutionDir)\obj\$(PlatformShortName)\$(Configuration)\</IntDir>
+ <TargetName>$(ProjectName).$(PlatformShortName)</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(SolutionDir)\bin\$(PlatformShortName)\$(Configuration)\</OutDir>
+ <IntDir>$(SolutionDir)\obj\$(PlatformShortName)\$(Configuration)\</IntDir>
+ <TargetName>$(ProjectName).$(PlatformShortName)</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(SolutionDir)\bin\$(PlatformShortName)\$(Configuration)\</OutDir>
+ <IntDir>$(SolutionDir)\obj\$(PlatformShortName)\$(Configuration)\</IntDir>
+ <TargetName>$(ProjectName).$(PlatformShortName)</TargetName>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(SolutionDir)\bin\$(PlatformShortName)\$(Configuration)\</OutDir>
+ <IntDir>$(SolutionDir)\obj\$(PlatformShortName)\$(Configuration)\</IntDir>
+ <TargetName>$(ProjectName).$(PlatformShortName)</TargetName>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MHASHJAVA384_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\include;$(SolutionDir)\..\..\..\include;$(JDK_HOME)\include;;$(JDK_HOME)\include\win32</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;MHASHJAVA384_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\include;$(SolutionDir)\..\..\..\include;$(JDK_HOME)\include;;$(JDK_HOME)\include\win32</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>Full</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MHASHJAVA384_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\include;$(SolutionDir)\..\..\..\include;$(JDK_HOME)\include;;$(JDK_HOME)\include\win32</AdditionalIncludeDirectories>
+ <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <OmitFramePointers>true</OmitFramePointers>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
+ <CreateHotpatchableImage>false</CreateHotpatchableImage>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <GenerateDebugInformation>No</GenerateDebugInformation>
+ <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <Optimization>Full</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;MHASHJAVA384_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\include;$(SolutionDir)\..\..\..\include;$(JDK_HOME)\include;;$(JDK_HOME)\include\win32</AdditionalIncludeDirectories>
+ <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <OmitFramePointers>true</OmitFramePointers>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
+ <CreateHotpatchableImage>false</CreateHotpatchableImage>
+ </ClCompile>
+ <Link>
+ <SubSystem>Windows</SubSystem>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <GenerateDebugInformation>No</GenerateDebugInformation>
+ <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+ </Link>
+ </ItemDefinitionGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="src\dllmain.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="src\MHashJava384.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="include\mhash_384.jni.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project>
\ No newline at end of file
JNIEXPORT void JNICALL Java_mhash_MHash384_00024Internals_destroyInstance
(JNIEnv *, jclass, jlong);
+/*
+ * Class: mhash_MHash384_Internals
+ * Method: getVersion
+ * Signature: ()[I
+ */
+JNIEXPORT jintArray JNICALL Java_mhash_MHash384_00024Internals_getVersion
+ (JNIEnv *, jclass);
+
#ifdef __cplusplus
}
#endif
--- /dev/null
+/* ---------------------------------------------------------------------------------------------- */
+/* MHash-384 - Language bindings for Java */
+/* Copyright(c) 2016 LoRd_MuldeR <mulder2@gmx.de> */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining a copy of this software */
+/* and associated documentation files (the "Software"), to deal in the Software without */
+/* restriction, including without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the */
+/* Software is furnished to do so, subject to the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be included in all copies or */
+/* substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING */
+/* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */
+/* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, */
+/* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, */
+/* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/* ---------------------------------------------------------------------------------------------- */
+
+#define MHASH_DISABLE_STL 1
+
+#include <mhash_384.h>
+#include <mhash_384.jni.h>
+
+JNIEXPORT jlong JNICALL Java_mhash_MHash384_00024Internals_createInstance(JNIEnv*, jclass)
+{
+ return reinterpret_cast<jlong>(new mhash::MHash384());
+}
+
+JNIEXPORT void JNICALL Java_mhash_MHash384_00024Internals_update(JNIEnv *const env, jclass, const jlong instance, const jbyteArray input, const jint offset, const jint len)
+{
+ jbyte *const input_ptr = env->GetByteArrayElements(input, NULL);
+ reinterpret_cast<mhash::MHash384*>(instance)->update(reinterpret_cast<uint8_t*>(input_ptr + offset), len);
+ env->ReleaseByteArrayElements(input, input_ptr, JNI_ABORT);
+}
+
+JNIEXPORT jbyteArray JNICALL Java_mhash_MHash384_00024Internals_finalize(JNIEnv *const env, jclass, const jlong instance)
+{
+ const jbyteArray result = env->NewByteArray(MHASH_384_LEN);
+ jbyte *const result_ptr = env->GetByteArrayElements(result, NULL);
+ reinterpret_cast<mhash::MHash384*>(instance)->finalize(reinterpret_cast<uint8_t*>(result_ptr));
+ env->ReleaseByteArrayElements(result, result_ptr, 0);
+ return result;
+}
+
+JNIEXPORT void JNICALL Java_mhash_MHash384_00024Internals_destroyInstance(JNIEnv*, jclass, const jlong instance)
+{
+ delete reinterpret_cast<mhash::MHash384*>(instance);
+}
+
+JNIEXPORT jintArray JNICALL Java_mhash_MHash384_00024Internals_getVersion(JNIEnv *const env, jclass)
+{
+ const jintArray version = env->NewIntArray(3);
+ jint *const version_ptr = env->GetIntArrayElements(version, NULL);
+ version_ptr[0] = (jint) MHASH_384_VERSION_MAJOR;
+ version_ptr[1] = (jint) MHASH_384_VERSION_MINOR;
+ version_ptr[2] = (jint) MHASH_384_VERSION_PATCH;
+ env->ReleaseIntArrayElements(version, version_ptr, 0);
+ return version;
+}
--- /dev/null
+/* ---------------------------------------------------------------------------------------------- */
+/* MHash-384 - Language bindings for Java */
+/* Copyright(c) 2016 LoRd_MuldeR <mulder2@gmx.de> */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining a copy of this software */
+/* and associated documentation files (the "Software"), to deal in the Software without */
+/* restriction, including without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the */
+/* Software is furnished to do so, subject to the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be included in all copies or */
+/* substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING */
+/* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */
+/* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, */
+/* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, */
+/* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/* ---------------------------------------------------------------------------------------------- */
+
+#define WIN32_LEAN_AND_MEAN 1
+#include <Windows.h>
+
+BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
private Long m_handle;
//--------------------------------------------------------------------
- // Public Methods
+ // Static Initializer
+ //--------------------------------------------------------------------
+
+ static {
+ final String libraryPath = getProperty("mhash384.library.path");
+ final String libraryName = getProperty("mhash384.library.name");
+ if(libraryPath != null) {
+ System.load(libraryPath);
+ }
+ else if(libraryName != null) {
+ System.loadLibrary(libraryName);
+ }
+ else {
+ final boolean x64 = getProperty("sun.arch.data.model", "32").equals("64");
+ System.loadLibrary("MHashJava384." + (x64 ? "x64" : "x86"));
+ }
+ }
+
+ //--------------------------------------------------------------------
+ // Constructor / Finalizer
//--------------------------------------------------------------------
public MHash384() {
m_handle = Internals.createInstance();
}
+ protected void finalize() {
+ close();
+ }
+
+ //--------------------------------------------------------------------
+ // Public Methods
+ //--------------------------------------------------------------------
+
public void update(final byte[] data, final int offset, final int len) {
+ if((offset < 0) || (len <= 0)) {
+ throw new IllegalArgumentException("offset or len must not be negative!");
+ }
+ if((offset + len < 0) || (offset + len > data.length)) {
+ throw new IndexOutOfBoundsException("offset + len exceeds array limits!");
+ }
Internals.update(m_handle, data, offset, len);
}
}
}
- protected void finalize() {
- close();
+ public static Version getVersion()
+ {
+ final int[] version = Internals.getVersion();
+ return new Version(version[0], version[1], version[2]);
}
-
+
//--------------------------------------------------------------------
// Native Methods
//--------------------------------------------------------------------
native static void update(final long handle, final byte[] data, final int offset, final int len);
native static byte[] finalize(final long handle);
native static void destroyInstance(final long handle);
+ native static int[] getVersion();
}
+ //--------------------------------------------------------------------
+ // Helper Class
+ //--------------------------------------------------------------------
+
+ public static class Version {
+ public final int major, minor, patch;
+ protected Version(int major, int minor, int patch) {
+ this.major = major;
+ this.minor = minor;
+ this.patch = patch;
+ }
+ }
+
+ //--------------------------------------------------------------------
+ // Utility Functions
+ //--------------------------------------------------------------------
+
+ private static String getProperty(final String key) {
+ return getProperty(key, null);
+ }
+
+ private static String getProperty(final String key, final String fallback) {
+ final String val = System.getProperty(key);
+ if(val != null) {
+ final String trimmed = val.trim();
+ if(!trimmed.isEmpty()) {
+ return trimmed;
+ }
+ }
+ return fallback;
+ }
}