Documented android unsafe wrapper for using internal sun.misc.Unsafe
api.
Android has no sun.misc.Unsafe
class in standard sdk library.
This library solves this problem by using compiled direct access to system class library (without using reflection).
Use only for experimental proposes and between pre-compiled dependency from jcenter because sun.misc.Unsafe
doesn't included in sdk library and you can't jst to create Unsafe class from source code!
For more explanation see this articles list:
- https://dzone.com/articles/understanding-sunmiscunsafe
- http://mishadoff.com/blog/java-magic-part-4-sun-dot-misc-dot-unsafe
For using in your own projects just add jcenter repository superset:
repositories {
jcenter()
}
And after it you should just add as compile dependency:
compile 'com.implimentz:unsafe:0.0.6'
You should use UnsafeAndroid
library class for Unsafe
class access:
final UnsafeAndroid unsafe = new UnsafeAndroid();
final Bitmap bitmap = unsafe.allocateInstance(Bitmap.class);
Copyright 2016 Alexander Efremenkov
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.