1 /*
2  * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.  Oracle designates this
8  * particular file as subject to the "Classpath" exception as provided
9  * by Oracle in the LICENSE file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22  * or visit www.oracle.com if you need additional information or have any
23  * questions.
24  */
25 
26 package sun.misc;
27 
28 /**
29  * A stub class for sun.misc.Unsafe to make it possible to build protobuf only using Android SDK,
30  * which lacks this class.
31  *
32  * Note that this class is only to provide symbol definitions at build-time and this class is not
33  * embedded in the protobuf library. At runtime, Unsafe class is provided by the libcore-oj which is
34  * in the bootclasspath and protobuf is linked to the class loaded there.
35  */
36 public class Unsafe {
allocateInstance(Class<?> clazz)37   public Object allocateInstance(Class<?> clazz) throws InstantiationException { /* null implementation */ return null; }
arrayIndexScale(Class arrayClass)38   public int arrayIndexScale(Class arrayClass) { /* null implementation */ return 0; }
arrayBaseOffset(Class arrayClass)39   public int arrayBaseOffset(Class arrayClass) { /* null implementation */ return 0; }
copyMemory(long srcAddress, long targetAddress, long length)40   public void copyMemory(long srcAddress, long targetAddress, long length) { /* null implmentation */ }
copyMemory(byte[] src, long srcIndex, byte[] target, long targetIndex, long length)41   public void copyMemory(byte[] src, long srcIndex, byte[] target, long targetIndex, long length) { /* null implmentation */ }
getBoolean(Object o, long offset)42   public boolean getBoolean(Object o, long offset) { /* null implementation */ return false; }
getBoolean(long address)43   public boolean getBoolean(long address) { /* null implementation */ return false; }
getByte(Object o, long offset)44   public byte getByte(Object o, long offset) { /* null implementation */ return 0; }
getByte(long address)45   public byte getByte(long address) { /* null implementation */ return 0; }
getFloat(Object o, long offset)46   public float getFloat(Object o, long offset) { /* null implementation */ return 0; }
getDouble(Object o, long offset)47   public double getDouble(Object o, long offset) { /* null implementation */ return 0; }
getInt(Object o, long offset)48   public int getInt(Object o, long offset) { /* null implementation */ return 0; }
getInt(long address)49   public int getInt(long address) { /* null implementation */ return 0; }
getLong(Object o, long offset)50   public long getLong(Object o, long offset) { /* null implementation */ return 0; }
getLong(long address)51   public long getLong(long address) { /* null implementation */ return 0; }
getObject(Object o, long offset)52   public Object getObject(Object o, long offset) { /* null implementation */ return null; }
objectFieldOffset(java.lang.reflect.Field f)53   public long objectFieldOffset(java.lang.reflect.Field f) { /* null implementation */ return 0; }
putBoolean(Object o, long offset, boolean x)54   public void putBoolean(Object o, long offset, boolean x) { /* null implementation */ }
putBoolean(long address, boolean x)55   public void putBoolean(long address, boolean x) { /* null implmentation */ }
putByte(Object o, long offset, byte x)56   public void putByte(Object o, long offset, byte x) { /* null implementation */ }
putByte(long address, byte x)57   public void putByte(long address, byte x) { /* null implmentation */ }
putFloat(Object o, long offset, float x)58   public void putFloat(Object o, long offset, float x) { /* null implementation */ }
putDouble(Object o, long offset, double x)59   public void putDouble(Object o, long offset, double x) { /* null implementation */ }
putInt(Object o, long offset, int x)60   public void putInt(Object o, long offset, int x) { /* null implementation */ }
putInt(long address, int x)61   public void putInt(long address, int x) { /* null implmentation */ }
putLong(Object o, long offset, long x)62   public void putLong(Object o, long offset, long x) { /* null implementation */ }
putLong(long address, long x)63   public void putLong(long address, long x) { /* null implmentation */ }
putObject(Object o, long offset, Object x)64   public void putObject(Object o, long offset, Object x) { /* null implementation */ }
staticFieldBase(java.lang.reflect.Field f)65   public Object staticFieldBase(java.lang.reflect.Field f) { /* null implementation */ return null; }
staticFieldOffset(java.lang.reflect.Field f)66   public long staticFieldOffset(java.lang.reflect.Field f) { /* null implementation */ return 0; }
67 }
68