KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > jimple > toolkits > pointer > nativemethods > JavaIoObjectOutputStreamNative


1 /* Soot - a J*va Optimization Framework
2  * Copyright (C) 2003 Feng Qian
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */

19
20 /**
21  * Simulates the native method side effects in class java.io.ObjectOutputStream
22  *
23  * @author Feng Qian
24  * @author <XXX>
25  */

26
27 package soot.jimple.toolkits.pointer.nativemethods;
28
29 import soot.*;
30 import soot.jimple.toolkits.pointer.representations.*;
31 import soot.jimple.toolkits.pointer.util.*;
32
33 public class JavaIoObjectOutputStreamNative extends NativeMethodClass {
34     public JavaIoObjectOutputStreamNative( NativeHelper helper ) { super(helper); }
35
36   /**
37    * Implements the abstract method simulateMethod.
38    * It distributes the request to the corresponding methods
39    * by signatures.
40    */

41   public void simulateMethod(SootMethod method,
42                  ReferenceVariable thisVar,
43                  ReferenceVariable returnVar,
44                  ReferenceVariable params[]){
45
46     String JavaDoc subSignature = method.getSubSignature();
47
48     if (subSignature.equals("java.lang.Object getObjectFieldValue(java.lang.Object,long)")){
49       java_io_ObjectOutputStream_getObjectFieldValue(method,
50                              thisVar,
51                              returnVar,
52                              params);
53       return;
54
55     } else {
56       defaultMethod(method, thisVar, returnVar, params);
57       return;
58
59     }
60   }
61
62   /******************* java.io.ObjectOutputStream *******************/
63   /**
64    * The object in field is retrieved out by field ID.
65    *
66    * private static native
67    * java.lang.Object getObjectFieldValue(java.lang.Object, long);
68    */

69   public
70     void java_io_ObjectOutputStream_getObjectFieldValue(
71                     SootMethod method,
72                     ReferenceVariable thisVar,
73                     ReferenceVariable returnVar,
74                     ReferenceVariable params[]){
75     throw new NativeMethodNotSupportedException(method);
76   }
77
78   /**
79    * Following three native methods have no side effects.
80    *
81    * private static native void floatsToBytes(float[], int, byte[], int, int);
82    * private static native void doublesToBytes(double[], int,
83    * byte[], int, int);
84    * private static native void getPrimitiveFieldValues(java.lang.Object,
85    * long[],
86    * char[],
87    * byte[]);
88    * @see default(...)
89    */

90 }
91
Popular Tags