Called from native code only; same as #newInstance(Class,Pointer), except that it additionally calls #conditionalAutoRead().
(Class<T> type, long init)
| 1916 | * {@link #conditionalAutoRead()}. |
| 1917 | */ |
| 1918 | private static <T extends Structure> T newInstance(Class<T> type, long init) { |
| 1919 | try { |
| 1920 | T s = newInstance(type, init == 0 ? PLACEHOLDER_MEMORY : new Pointer(init)); |
| 1921 | if (init != 0) { |
| 1922 | s.conditionalAutoRead(); |
| 1923 | } |
| 1924 | return s; |
| 1925 | } |
| 1926 | catch(Throwable e) { |
| 1927 | LOG.log(Level.WARNING, "JNA: Error creating structure", e); |
| 1928 | return null; |
| 1929 | } |
| 1930 | } |
| 1931 | |
| 1932 | /** Create a new Structure instance of the given type, initialized with |
| 1933 | * the given memory. |