From 66d7c812b365f74fa53fa13b1ba2580d6a0f2a13 Mon Sep 17 00:00:00 2001 From: jfrijters Date: Mon, 17 Mar 2003 14:02:46 +0000 Subject: [PATCH] *** empty log message *** --- IK.VM.NET/ClassFile.cs | 7 +- IK.VM.NET/ClassLoaderWrapper.cs | 25 +- IK.VM.NET/JavaException.cs | 9 +- IK.VM.NET/StringHelper.cs | 196 +-- IK.VM.NET/TypeWrapper.cs | 130 +- IK.VM.NET/classpath.cs | 23 +- IK.VM.NET/map.xml | 45 +- IK.VM.NET/mapxml.cs | 1525 ++++++++++++----------- IK.VM.NET/vm.cs | 17 +- awt/toolkit.cs | 96 ++ classpath/allsources.lst | 53 +- classpath/java/io/FileDescriptor.java | 257 ++-- classpath/java/io/FileInputStream.java | 396 ------ classpath/java/io/FileOutputStream.java | 339 ----- classpath/java/io/RandomAccessFile.java | 1197 ------------------ classpath/java/lang/StringHelper.java | 364 ++++++ classpath/java/lang/VMClassLoader.java | 7 +- classpath/java/lang/reflect/Field.java | 22 +- classpath/java/lang/reflect/Method.java | 24 +- ikvm/starter.cs | 21 +- 20 files changed, 1680 insertions(+), 3073 deletions(-) delete mode 100644 classpath/java/io/FileInputStream.java delete mode 100644 classpath/java/io/FileOutputStream.java delete mode 100644 classpath/java/io/RandomAccessFile.java create mode 100644 classpath/java/lang/StringHelper.java diff --git a/IK.VM.NET/ClassFile.cs b/IK.VM.NET/ClassFile.cs index bed9b116..98c95376 100644 --- a/IK.VM.NET/ClassFile.cs +++ b/IK.VM.NET/ClassFile.cs @@ -627,10 +627,13 @@ class ClassFile { return classLoader.LoadClassBySlashedName(name); } - catch(Exception) + catch(Exception x) { - // TODO consider what to do with this error, may be a command line switch? // TODO it might not be a good idea to catch .NET system exceptions here + if(JVM.LogClassLoadFailures) + { + Console.Error.WriteLine(x); + } return new UnloadableTypeWrapper(name); } } diff --git a/IK.VM.NET/ClassLoaderWrapper.cs b/IK.VM.NET/ClassLoaderWrapper.cs index 9931dabb..e42511fd 100644 --- a/IK.VM.NET/ClassLoaderWrapper.cs +++ b/IK.VM.NET/ClassLoaderWrapper.cs @@ -127,7 +127,7 @@ class ClassLoaderWrapper internal void LoadRemappedTypes() { nativeMethods = new Hashtable(); - // NOTE interfaces have *not* java/lang/Object as the base type (even though they do in the class file) + // NOTE interfaces do *not* have java/lang/Object as the base type (even though they do in the class file) types["java.lang.Cloneable"] = new RemappedTypeWrapper(this, ModifiersAttribute.GetModifiers(typeof(java.lang.Cloneable)), "java/lang/Cloneable", typeof(java.lang.Cloneable), new TypeWrapper[0], null); typeToTypeWrapper.Add(typeof(java.lang.Cloneable), types["java.lang.Cloneable"]); types["java.io.Serializable"] = new RemappedTypeWrapper(this, ModifiersAttribute.GetModifiers(typeof(java.io.Serializable)), "java/io/Serializable", typeof(java.io.Serializable), new TypeWrapper[0], null); @@ -152,6 +152,11 @@ class ClassLoaderWrapper types.Add(name, tw); typeToTypeWrapper.Add(tw.Type, tw); } + } + + internal void LoadRemappedTypesStep2() + { + MapXml.Root map = MapXmlGenerator.Generate(); foreach(MapXml.Class c in map.remappings) { ((RemappedTypeWrapper)types[c.Name]).LoadRemappings(c); @@ -175,8 +180,18 @@ class ClassLoaderWrapper return LoadClassByDottedName(name.Replace('/', '.')); } - // TODO implement vmspec 5.3.4 Loading Constraints internal TypeWrapper LoadClassByDottedName(string name) + { + TypeWrapper type = LoadClassByDottedNameFast(name); + if(type != null) + { + return type; + } + throw JavaException.ClassNotFoundException(name); + } + + // TODO implement vmspec 5.3.4 Loading Constraints + internal TypeWrapper LoadClassByDottedNameFast(string name) { if(name == null) { @@ -222,8 +237,7 @@ class ClassLoaderWrapper case 'Z': return GetBootstrapClassLoader().CreateArrayType(name, typeof(bool), dims); default: - // TODO I'm not sure this is the right exception here (instead we could throw a NoClassDefFoundError) - throw JavaException.ClassNotFoundException(name); + return null; } } if(this == GetBootstrapClassLoader()) @@ -247,7 +261,7 @@ class ClassLoaderWrapper } if(javaClassLoader == null) { - throw JavaException.ClassNotFoundException(name); + return null; } } // NOTE just like Java does (I think), we take the classloader lock before calling the loadClass method @@ -755,6 +769,7 @@ class ClassLoaderWrapper { bootstrapClassLoader = new ClassLoaderWrapper(null); bootstrapClassLoader.LoadRemappedTypes(); + bootstrapClassLoader.LoadRemappedTypesStep2(); } return bootstrapClassLoader; } diff --git a/IK.VM.NET/JavaException.cs b/IK.VM.NET/JavaException.cs index c34002dc..dd9c5ce4 100644 --- a/IK.VM.NET/JavaException.cs +++ b/IK.VM.NET/JavaException.cs @@ -68,6 +68,8 @@ sealed class JavaException private class BootstrapClassMissing : Exception {} + private static ConstructorInfo classNotFoundConstructor; + internal static Exception ClassNotFoundException(string s, params object[] args) { // HACK if java.lang.ClassNotFoundException is not found, this method would recurse until the @@ -86,8 +88,11 @@ sealed class JavaException classNotFound = true; //Console.WriteLine("ClassNotFoundException: " + s); s = String.Format(s, args); - ConstructorInfo ci = ClassLoaderWrapper.GetType("java.lang.ClassNotFoundException").GetConstructor(new Type[] { typeof(string) }); - return (Exception)ci.Invoke(new object[] { s }); + if(classNotFoundConstructor == null) + { + classNotFoundConstructor = ClassLoaderWrapper.GetType("java.lang.ClassNotFoundException").GetConstructor(new Type[] { typeof(string) }); + } + return (Exception)classNotFoundConstructor.Invoke(new object[] { s }); } catch(BootstrapClassMissing) { diff --git a/IK.VM.NET/StringHelper.cs b/IK.VM.NET/StringHelper.cs index a3ac4cf7..6f48b089 100644 --- a/IK.VM.NET/StringHelper.cs +++ b/IK.VM.NET/StringHelper.cs @@ -27,100 +27,6 @@ using System.Reflection; public class StringHelper { - public static string NewString(char[] data, int offset, int count, bool dont_copy) - { - return new String(data, offset, count); - } - - public static string NewString(sbyte[] sdata) - { - return NewString(sdata, 0, sdata.Length); - } - - public static string NewString(sbyte[] sdata, int hibyte) - { - return NewString(sdata, hibyte, 0, sdata.Length); - } - - public static string NewString(sbyte[] sdata, int offset, int count) - { - // TODO what encoding should this use? - // TODO could use the unsafe constructor that takes sbyte*, but I don't know if that is worthwhile to be unsafe for - byte[] data = new byte[sdata.Length]; - for(int i = 0; i < data.Length; i++) - { - data[i] = (byte)sdata[i]; - } - try { - return System.Text.Encoding.ASCII.GetString(data, offset, count); - } - catch { - return null; - } - } - - public static string NewString(sbyte[] sdata, int hibyte, int offset, int count) - { - // TODO benchmark this versus using a stringbuilder instead of a char[] - hibyte <<= 8; - char[] data = new char[count]; - for(int i = 0; i < count; i++) - { - // TODO what happens for negative bytes? - data[i] = (char)(((byte)sdata[i + offset]) | hibyte); - } - return new String(data); - } - - public static string NewString(sbyte[] sdata, string charsetName) - { - return NewString(sdata, 0, sdata.Length, charsetName); - } - - public static string NewString(sbyte[] sdata, int offset, int count, string charsetName) - { - // HACK special case for UTF8, I really need to implement this by - // redirecting to the classpath character encoding support - if(charsetName == "UTF8") - { - char[] ch = new Char[count]; - int l = 0; - for(int i = 0; i < count; i++) - { - int c = (byte)sdata[offset + i]; - int char2, char3; - switch (c >> 4) - { - case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: - // 0xxxxxxx - break; - case 12: case 13: - // 110x xxxx 10xx xxxx - char2 = (byte)sdata[offset + ++i]; - c = (((c & 0x1F) << 6) | (char2 & 0x3F)); - break; - case 14: - // 1110 xxxx 10xx xxxx 10xx xxxx - char2 = (byte)sdata[offset + ++i]; - char3 = (byte)sdata[offset + ++i]; - c = (((c & 0x0F) << 12) | ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0)); - break; - } - ch[l++] = (char)c; - } - return new String(ch, 0, l); - } - // TODO don't use reflection, but write a Java helper class and redirect this method there - Type t = ClassLoaderWrapper.GetType("gnu.java.io.EncodingManager"); - try { - object decoder = t.InvokeMember("getDecoder", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Static, null, null, new object[] { charsetName }); - return new String((char[])decoder.GetType().InvokeMember("convertToChars", BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public, null, decoder, new object[] { sdata, offset, count })); - } - catch (TargetInvocationException ex) { - throw ExceptionHelper.MapExceptionFast(ex.InnerException); - } - } - public static string valueOf(bool b) { return b ? "true" : "false"; @@ -216,91 +122,12 @@ public class StringHelper return 0; } - public static bool equalsIgnoreCase(string s1, string s2) - { - return String.Compare(s1, s2, true) == 0; - } - - public static int compareToIgnoreCase(string s1, string s2) - { - return String.Compare(s1, s2, true); - } - - public static int compareTo(string s1, string s2) - { - int len = Math.Min(s1.Length, s2.Length); - for(int i = 0; i < len; i++) - { - int diff = s1[i] - s2[i]; - if(diff != 0) - { - return diff; - } - } - return s1.Length - s2.Length; - } - - public static sbyte[] getBytes(string s) - { - byte[] data = System.Text.Encoding.ASCII.GetBytes(s); - sbyte[] sdata = new sbyte[data.Length]; - for(int i = 0; i < data.Length; i++) - { - sdata[i] = (sbyte)data[i]; - } - return sdata; - } - - public static sbyte[] getBytes(string s, string charsetName) - { - // TODO don't use reflection, but write a Java helper class and redirect this method there - char[] ch = s.ToCharArray(); - Type t = ClassLoaderWrapper.GetType("gnu.java.io.EncodingManager"); - object encoder = t.InvokeMember("getEncoder", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Static, null, null, new object[] { charsetName }); - return (sbyte[])encoder.GetType().InvokeMember("convertToBytes", BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public, null, encoder, new object[] { ch, 0, ch.Length }); - } - - public static void getBytes(string s, int srcBegin, int srcEnd, sbyte[] dst, int dstBegin) - { - if(srcBegin > srcEnd) - { - throw JavaException.ArrayIndexOutOfBoundsException(); - } - for(int i = 0; i < (srcEnd - srcBegin); i++) - { - dst[i + dstBegin] = (sbyte)s[i + srcBegin]; - } - } - public static object subSequence(string s, int offset, int count) { // TODO throw new NotImplementedException(); } - public static bool regionMatches(string s, int toffset, string other, int ooffset, int len) - { - return regionMatches(s, false, toffset, other, ooffset, len); - } - - public static bool regionMatches(string s, bool ignoreCase, int toffset, string other, int ooffset, int len) - { - if(toffset < 0 || ooffset < 0 || toffset + len > s.Length || ooffset + len > other.Length) - { - return false; - } - while(--len >= 0) - { - char c1 = s[toffset++]; - char c2 = other[ooffset++]; - if(c1 != c2 && (!ignoreCase || (Char.ToLower(c1) != Char.ToLower(c2) && (Char.ToUpper(c1) != Char.ToUpper(c2))))) - { - return false; - } - } - return true; - } - // NOTE argument is of type object, because otherwise the code that calls this function // has to be much more complex public static int hashCode(object s) @@ -313,18 +140,6 @@ public class StringHelper return h; } - public static string toUpperCase(string s, object locale) - { - // TODO - return s.ToUpper(); - } - - public static string toLowerCase(string s, object locale) - { - // TODO - return s.ToLower(); - } - public static int indexOf(string s, char ch, int fromIndex) { // Java allow fromIndex to both below zero or above the length of the string, .NET doesn't @@ -379,6 +194,17 @@ public class StringHelper } return String.Concat(s1, s2); } + + private static object CASE_INSENSITIVE_ORDER; + + public static object GetCaseInsensitiveOrder() + { + if(CASE_INSENSITIVE_ORDER == null) + { + CASE_INSENSITIVE_ORDER = Activator.CreateInstance(ClassLoaderWrapper.GetType("java.lang.String$CaseInsensitiveComparator"), true); + } + return CASE_INSENSITIVE_ORDER; + } } public class StringBufferHelper diff --git a/IK.VM.NET/TypeWrapper.cs b/IK.VM.NET/TypeWrapper.cs index f9fe9fcc..c7411e7f 100644 --- a/IK.VM.NET/TypeWrapper.cs +++ b/IK.VM.NET/TypeWrapper.cs @@ -829,27 +829,27 @@ class UnloadableTypeWrapper : TypeWrapper protected override FieldWrapper GetFieldImpl(string fieldName) { - throw new InvalidOperationException("GetFieldImpl called on UnloadableTypeWrapper"); + throw new InvalidOperationException("GetFieldImpl called on UnloadableTypeWrapper: " + Name); } protected override MethodWrapper GetMethodImpl(MethodDescriptor md) { - throw new InvalidOperationException("GetMethodImpl called on UnloadableTypeWrapper"); + throw new InvalidOperationException("GetMethodImpl called on UnloadableTypeWrapper: " + Name); } public override Type Type { get { - throw new InvalidOperationException("get_Type called on UnloadableTypeWrapper"); - } - } + throw new InvalidOperationException("get_Type called on UnloadableTypeWrapper: " + Name); + } + } public override bool IsInterface { get { - throw new InvalidOperationException("get_IsInterface called on UnloadableTypeWrapper"); + throw new InvalidOperationException("get_IsInterface called on UnloadableTypeWrapper: " + Name); } } @@ -857,7 +857,7 @@ class UnloadableTypeWrapper : TypeWrapper { get { - throw new InvalidOperationException("get_Interfaces called on UnloadableTypeWrapper"); + throw new InvalidOperationException("get_Interfaces called on UnloadableTypeWrapper: " + Name); } } @@ -865,7 +865,7 @@ class UnloadableTypeWrapper : TypeWrapper { get { - throw new InvalidOperationException("get_InnerClasses called on UnloadableTypeWrapper"); + throw new InvalidOperationException("get_InnerClasses called on UnloadableTypeWrapper: " + Name); } } @@ -873,13 +873,13 @@ class UnloadableTypeWrapper : TypeWrapper { get { - throw new InvalidOperationException("get_DeclaringTypeWrapper called on UnloadableTypeWrapper"); + throw new InvalidOperationException("get_DeclaringTypeWrapper called on UnloadableTypeWrapper: " + Name); } } public override void Finish() { - throw new InvalidOperationException("Finish called on UnloadableTypeWrapper"); + throw new InvalidOperationException("Finish called on UnloadableTypeWrapper: " + Name); } } @@ -1948,7 +1948,7 @@ class DynamicTypeWrapper : TypeWrapper } MethodBuilder mb = typeBuilder.DefineMethod(name, attribs, retType, args); method = mb; - // since Java constructors (and static intializers?) aren't allowed to be synchronized, we only check this here + // since Java constructors (and static intializers) aren't allowed to be synchronized, we only check this here if(m.IsSynchronized) { mb.SetImplementationFlags(method.GetMethodImplementationFlags() | MethodImplAttributes.Synchronized); @@ -1963,8 +1963,9 @@ class DynamicTypeWrapper : TypeWrapper if(retTypeWrapper.IsUnloadable) { CustomAttributeBuilder attrib = new CustomAttributeBuilder(typeof(UnloadableTypeAttribute).GetConstructor(new Type[] { typeof(string) }), new object[] { retTypeWrapper.Name }); - // TODO DefineParameter(0, ...) throws an exception, even though this looks like the way to do it... - ((MethodBuilder)method).DefineParameter(0, ParameterAttributes.None, null).SetCustomAttribute(attrib); + // NOTE since DefineParameter(0, ...) throws an exception (bug in .NET, I believe), + // we attach the attribute to the method instead of the return value + ((MethodBuilder)method).SetCustomAttribute(attrib); } for(int i = 0; i < argTypeWrappers.Length; i++) { @@ -2150,12 +2151,27 @@ class RemappedTypeWrapper : TypeWrapper { binding |= BindingFlags.Instance; } - Type t = this.type; if(method.redirect.Class != null) { - t = Type.GetType(method.redirect.Class, true); + TypeWrapper tw = ClassLoaderWrapper.GetBootstrapClassLoader().LoadClassByDottedName(method.redirect.Class); + if(tw is DynamicTypeWrapper) + { + MethodWrapper mw1 = tw.GetMethodWrapper(redir, false); + if(mw1 == null) + { + Console.WriteLine("method not found: " + tw.Name + "." + redir.Name + redir.Signature); + } + redirect = mw1.GetMethod(); + } + else + { + redirect = tw.Type.GetMethod(name, binding, null, CallingConventions.Standard, redir.ArgTypes, null); + } + } + else + { + redirect = this.type.GetMethod(name, binding, null, CallingConventions.Standard, redir.ArgTypes, null); } - redirect = t.GetMethod(name, binding, null, CallingConventions.Standard, redir.ArgTypes, null); if(redirect == null) { throw new InvalidOperationException("remapping method: " + name + sig + " not found"); @@ -2196,11 +2212,7 @@ class RemappedTypeWrapper : TypeWrapper } } } - // NOTE we abuse MethodWrapper.Create here to construct the emitters for us - MethodWrapper temp = MethodWrapper.Create(this, md, overrideMethod, redirect, modifiers); - newopc = temp.EmitNewobj; - invokespecial = temp.EmitCall; - invokevirtual = temp.EmitCallvirt; + MethodWrapper.CreateEmitters(overrideMethod, redirect, ref invokespecial, ref invokevirtual, ref newopc); } else { @@ -2234,6 +2246,14 @@ class RemappedTypeWrapper : TypeWrapper invokevirtual = CodeEmitter.Create(OpCodes.Callvirt, (MethodInfo)overrideMethod); } } + // HACK MethodWrapper doesn't accept a MethodBuilder, so we have to blank it out, note + // that this means that reflection won't work on this method, so we have to add support + // for that + // TODO support reflection + if(redirect is MethodBuilder) + { + redirect = null; + } MethodWrapper mw = new MethodWrapper(this, md, overrideMethod, redirect, modifiers); mw.EmitNewobj = newopc; mw.EmitCall = invokespecial; @@ -2312,19 +2332,42 @@ class RemappedTypeWrapper : TypeWrapper { binding |= BindingFlags.Instance; } - Type t = this.type; + MethodBase redirect = null; if(constructor.redirect.Class != null) { - t = Type.GetType(constructor.redirect.Class, true); - } - MethodBase redirect = null; - if(constructor.redirect.Name != null) - { - redirect = t.GetMethod(constructor.redirect.Name, binding, null, CallingConventions.Standard, redir.ArgTypes, null); + TypeWrapper tw = ClassLoaderWrapper.GetBootstrapClassLoader().LoadClassByDottedName(constructor.redirect.Class); + if(tw is DynamicTypeWrapper) + { + MethodDescriptor md1 = new MethodDescriptor(GetClassLoader(), constructor.redirect.Name != null ? constructor.redirect.Name : "", sig); + MethodWrapper mw1 = tw.GetMethodWrapper(md1, false); + if(mw1 == null) + { + Console.WriteLine("constructor not found: " + tw.Name + "." + redir.Name + redir.Signature); + } + redirect = mw1.GetMethod(); + } + else + { + if(constructor.redirect.Name != null) + { + redirect = tw.Type.GetMethod(constructor.redirect.Name, binding, null, CallingConventions.Standard, redir.ArgTypes, null); + } + else + { + redirect = tw.Type.GetConstructor(binding, null, CallingConventions.Standard, redir.ArgTypes, null); + } + } } else { - redirect = t.GetConstructor(binding, null, CallingConventions.Standard, redir.ArgTypes, null); + if(constructor.redirect.Name != null) + { + redirect = this.type.GetMethod(constructor.redirect.Name, binding, null, CallingConventions.Standard, redir.ArgTypes, null); + } + else + { + redirect = this.type.GetConstructor(binding, null, CallingConventions.Standard, redir.ArgTypes, null); + } } if(redirect == null) { @@ -2410,10 +2453,14 @@ class RemappedTypeWrapper : TypeWrapper { throw new InvalidOperationException("remapping method: " + name + sig + " not found"); } - // TODO ensure that return type for redirected method matches with field type, or emit a castclass FieldWrapper fw = new FieldWrapper(this, fieldName, fieldSig, modifiers); fw.EmitGet = CodeEmitter.Create(OpCodes.Call, method); fw.EmitSet = null; + // ensure that return type for redirected method matches with field type, or emit a castclass + if(!field.redirect.Sig.EndsWith(fieldSig)) + { + fw.EmitGet += new CastEmitter("()" + fieldSig); + } AddField(fw); } } @@ -3525,33 +3572,38 @@ sealed class MethodWrapper throw new InvalidOperationException(); } MethodWrapper wrapper = new MethodWrapper(declaringType, md, originalMethod, method, modifiers); + CreateEmitters(originalMethod, method, ref wrapper.EmitCall, ref wrapper.EmitCallvirt, ref wrapper.EmitNewobj); + return wrapper; + } + + internal static void CreateEmitters(MethodBase originalMethod, MethodBase method, ref CodeEmitter call, ref CodeEmitter callvirt, ref CodeEmitter newobj) + { if(method is ConstructorInfo) { - wrapper.EmitCall = CodeEmitter.Create(OpCodes.Call, (ConstructorInfo)method); - wrapper.EmitCallvirt = null; - wrapper.EmitNewobj = CodeEmitter.Create(OpCodes.Newobj, (ConstructorInfo)method); + call = CodeEmitter.Create(OpCodes.Call, (ConstructorInfo)method); + callvirt = null; + newobj = CodeEmitter.Create(OpCodes.Newobj, (ConstructorInfo)method); } else { - wrapper.EmitCall = CodeEmitter.Create(OpCodes.Call, (MethodInfo)method); + call = CodeEmitter.Create(OpCodes.Call, (MethodInfo)method); if(originalMethod != null && originalMethod != method) { // if we're calling a virtual method that is redirected, that overrides an already // existing method, we have to call it virtually, instead of redirecting - wrapper.EmitCallvirt = CodeEmitter.Create(OpCodes.Callvirt, (MethodInfo)originalMethod); + callvirt = CodeEmitter.Create(OpCodes.Callvirt, (MethodInfo)originalMethod); } else if(method.IsStatic) { // because of redirection, it can be legal to call a static method with invokevirtual - wrapper.EmitCallvirt = CodeEmitter.Create(OpCodes.Call, (MethodInfo)method); + callvirt = CodeEmitter.Create(OpCodes.Call, (MethodInfo)method); } else { - wrapper.EmitCallvirt = CodeEmitter.Create(OpCodes.Callvirt, (MethodInfo)method); + callvirt = CodeEmitter.Create(OpCodes.Callvirt, (MethodInfo)method); } - wrapper.EmitNewobj = CodeEmitter.Create(OpCodes.Call, (MethodInfo)method); + newobj = CodeEmitter.Create(OpCodes.Call, (MethodInfo)method); } - return wrapper; } internal MethodWrapper(TypeWrapper declaringType, MethodDescriptor md, MethodBase originalMethod, MethodBase method, Modifiers modifiers) diff --git a/IK.VM.NET/classpath.cs b/IK.VM.NET/classpath.cs index 0013308e..f3cf0a93 100644 --- a/IK.VM.NET/classpath.cs +++ b/IK.VM.NET/classpath.cs @@ -918,13 +918,17 @@ namespace NativeCode.java public static object loadBootstrapClass(string name, bool initialize) { - TypeWrapper type = ClassLoaderWrapper.GetBootstrapClassLoader().LoadClassByDottedName(name); - type.Finish(); - if(initialize) + TypeWrapper type = ClassLoaderWrapper.GetBootstrapClassLoader().LoadClassByDottedNameFast(name); + if(type != null) { - RuntimeHelpers.RunClassConstructor(type.Type.TypeHandle); + if(initialize) + { + type.Finish(); + RuntimeHelpers.RunClassConstructor(type.Type.TypeHandle); + } + return getClassFromWrapper(type); } - return getClassFromType(type.Type); + return null; } internal static object CreateInstance(Type type, TypeWrapper wrapper) @@ -1685,8 +1689,13 @@ namespace NativeCode.java { public static string getDefaultTimeZoneId() { - // HACK return null, classpath then assumes GMT, which is fine by me, for the time being - return null; + NetSystem.TimeZone currentTimeZone = NetSystem.TimeZone.CurrentTimeZone; + NetSystem.TimeSpan timeSpan = currentTimeZone.GetUtcOffset(DateTime.Now); + + int hours = timeSpan.Hours; + int mins = timeSpan.Minutes; + + return "GMT" + hours + ":" + mins; } } } diff --git a/IK.VM.NET/map.xml b/IK.VM.NET/map.xml index eebf9ac8..ec563e0b 100644 --- a/IK.VM.NET/map.xml +++ b/IK.VM.NET/map.xml @@ -1,6 +1,6 @@ - + @@ -118,22 +118,22 @@ - + - + - + - + - + - + @@ -220,52 +220,52 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -280,6 +280,9 @@ + + + diff --git a/IK.VM.NET/mapxml.cs b/IK.VM.NET/mapxml.cs index ac3a30b8..de05e66a 100644 --- a/IK.VM.NET/mapxml.cs +++ b/IK.VM.NET/mapxml.cs @@ -240,7 +240,7 @@ MapXml.Constructor obj171 = new MapXml.Constructor(); obj171.Sig = "([CIIZ)V"; obj171.Modifiers = (MapXml.MapModifiers)0; MapXml.Redirect obj174 = new MapXml.Redirect(); -obj174.Class = "StringHelper"; +obj174.Class = "java.lang.StringHelper"; obj174.Name = "NewString"; obj174.Sig = "([CIIZ)Ljava/lang/String;"; obj174.Type = "static"; @@ -269,7 +269,7 @@ MapXml.Constructor obj194 = new MapXml.Constructor(); obj194.Sig = "([B)V"; obj194.Modifiers = (MapXml.MapModifiers)1; MapXml.Redirect obj197 = new MapXml.Redirect(); -obj197.Class = "StringHelper"; +obj197.Class = "java.lang.StringHelper"; obj197.Name = "NewString"; obj197.Sig = "([B)Ljava/lang/String;"; obj197.Type = "static"; @@ -279,7 +279,7 @@ MapXml.Constructor obj202 = new MapXml.Constructor(); obj202.Sig = "([BI)V"; obj202.Modifiers = (MapXml.MapModifiers)1; MapXml.Redirect obj205 = new MapXml.Redirect(); -obj205.Class = "StringHelper"; +obj205.Class = "java.lang.StringHelper"; obj205.Name = "NewString"; obj205.Sig = "([BI)Ljava/lang/String;"; obj205.Type = "static"; @@ -289,7 +289,7 @@ MapXml.Constructor obj210 = new MapXml.Constructor(); obj210.Sig = "([BII)V"; obj210.Modifiers = (MapXml.MapModifiers)1; MapXml.Redirect obj213 = new MapXml.Redirect(); -obj213.Class = "StringHelper"; +obj213.Class = "java.lang.StringHelper"; obj213.Name = "NewString"; obj213.Sig = "([BII)Ljava/lang/String;"; obj213.Type = "static"; @@ -299,7 +299,7 @@ MapXml.Constructor obj218 = new MapXml.Constructor(); obj218.Sig = "([BIII)V"; obj218.Modifiers = (MapXml.MapModifiers)1; MapXml.Redirect obj221 = new MapXml.Redirect(); -obj221.Class = "StringHelper"; +obj221.Class = "java.lang.StringHelper"; obj221.Name = "NewString"; obj221.Sig = "([BIII)Ljava/lang/String;"; obj221.Type = "static"; @@ -309,7 +309,7 @@ MapXml.Constructor obj226 = new MapXml.Constructor(); obj226.Sig = "([BLjava/lang/String;)V"; obj226.Modifiers = (MapXml.MapModifiers)1; MapXml.Redirect obj229 = new MapXml.Redirect(); -obj229.Class = "StringHelper"; +obj229.Class = "java.lang.StringHelper"; obj229.Name = "NewString"; obj229.Sig = "([BLjava/lang/String;)Ljava/lang/String;"; obj229.Type = "static"; @@ -319,7 +319,7 @@ MapXml.Constructor obj234 = new MapXml.Constructor(); obj234.Sig = "([BIILjava/lang/String;)V"; obj234.Modifiers = (MapXml.MapModifiers)1; MapXml.Redirect obj237 = new MapXml.Redirect(); -obj237.Class = "StringHelper"; +obj237.Class = "java.lang.StringHelper"; obj237.Name = "NewString"; obj237.Sig = "([BIILjava/lang/String;)Ljava/lang/String;"; obj237.Type = "static"; @@ -578,767 +578,784 @@ obj433.Name = "toUpperCase"; obj433.Sig = "()Ljava/lang/String;"; obj433.Modifiers = (MapXml.MapModifiers)1; MapXml.Redirect obj437 = new MapXml.Redirect(); -obj437.Name = "ToUpper"; +obj437.Class = "java.lang.StringHelper"; +obj437.Sig = "(Ljava/lang/String;)Ljava/lang/String;"; +obj437.Type = "static"; obj433.redirect = obj437; obj242[28] = obj433; -MapXml.Method obj439 = new MapXml.Method(); -obj439.Name = "toUpperCase"; -obj439.Sig = "(Ljava/util/Locale;)Ljava/lang/String;"; -obj439.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj443 = new MapXml.Redirect(); -obj443.Class = "StringHelper"; -obj443.Sig = "(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;"; -obj443.Type = "static"; -obj439.redirect = obj443; -obj242[29] = obj439; -MapXml.Method obj447 = new MapXml.Method(); -obj447.Name = "toLowerCase"; -obj447.Sig = "()Ljava/lang/String;"; -obj447.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj451 = new MapXml.Redirect(); -obj451.Name = "ToLower"; -obj447.redirect = obj451; -obj242[30] = obj447; -MapXml.Method obj453 = new MapXml.Method(); -obj453.Name = "toLowerCase"; -obj453.Sig = "(Ljava/util/Locale;)Ljava/lang/String;"; -obj453.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj457 = new MapXml.Redirect(); -obj457.Class = "StringHelper"; -obj457.Sig = "(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;"; -obj457.Type = "static"; -obj453.redirect = obj457; -obj242[31] = obj453; -MapXml.Method obj461 = new MapXml.Method(); -obj461.Name = "compareToIgnoreCase"; -obj461.Sig = "(Ljava/lang/String;)I"; -obj461.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj465 = new MapXml.Redirect(); -obj465.Class = "StringHelper"; -obj465.Sig = "(Ljava/lang/String;Ljava/lang/String;)I"; -obj465.Type = "static"; -obj461.redirect = obj465; -obj242[32] = obj461; -MapXml.Method obj469 = new MapXml.Method(); -obj469.Name = "equalsIgnoreCase"; -obj469.Sig = "(Ljava/lang/String;)Z"; -obj469.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj473 = new MapXml.Redirect(); -obj473.Class = "StringHelper"; -obj473.Sig = "(Ljava/lang/String;Ljava/lang/String;)Z"; -obj473.Type = "static"; -obj469.redirect = obj473; -obj242[33] = obj469; -MapXml.Method obj477 = new MapXml.Method(); -obj477.Name = "intern"; -obj477.Sig = "()Ljava/lang/String;"; -obj477.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj481 = new MapXml.Redirect(); -obj481.Name = "Intern"; -obj481.Sig = "(Ljava/lang/String;)Ljava/lang/String;"; -obj481.Type = "static"; -obj477.redirect = obj481; -obj242[34] = obj477; -MapXml.Method obj485 = new MapXml.Method(); -obj485.Name = "compareTo"; -obj485.Sig = "(Ljava/lang/String;)I"; -obj485.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj489 = new MapXml.Redirect(); -obj489.Class = "StringHelper"; -obj489.Sig = "(Ljava/lang/String;Ljava/lang/String;)I"; -obj489.Type = "static"; -obj485.redirect = obj489; -obj242[35] = obj485; -MapXml.Method obj493 = new MapXml.Method(); -obj493.Name = "replace"; -obj493.Sig = "(CC)Ljava/lang/String;"; -obj493.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj497 = new MapXml.Redirect(); -obj497.Name = "Replace"; -obj493.redirect = obj497; -obj242[36] = obj493; -MapXml.Method obj499 = new MapXml.Method(); -obj499.Name = "getBytes"; -obj499.Sig = "()[B"; -obj499.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj503 = new MapXml.Redirect(); -obj503.Class = "StringHelper"; -obj503.Sig = "(Ljava/lang/String;)[B"; -obj503.Type = "static"; -obj499.redirect = obj503; -obj242[37] = obj499; -MapXml.Method obj507 = new MapXml.Method(); -obj507.Name = "getBytes"; +MapXml.Method obj441 = new MapXml.Method(); +obj441.Name = "toUpperCase"; +obj441.Sig = "(Ljava/util/Locale;)Ljava/lang/String;"; +obj441.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj445 = new MapXml.Redirect(); +obj445.Class = "java.lang.StringHelper"; +obj445.Sig = "(Ljava/lang/String;Ljava/util/Locale;)Ljava/lang/String;"; +obj445.Type = "static"; +obj441.redirect = obj445; +obj242[29] = obj441; +MapXml.Method obj449 = new MapXml.Method(); +obj449.Name = "toLowerCase"; +obj449.Sig = "()Ljava/lang/String;"; +obj449.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj453 = new MapXml.Redirect(); +obj453.Class = "java.lang.StringHelper"; +obj453.Sig = "(Ljava/lang/String;)Ljava/lang/String;"; +obj453.Type = "static"; +obj449.redirect = obj453; +obj242[30] = obj449; +MapXml.Method obj457 = new MapXml.Method(); +obj457.Name = "toLowerCase"; +obj457.Sig = "(Ljava/util/Locale;)Ljava/lang/String;"; +obj457.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj461 = new MapXml.Redirect(); +obj461.Class = "java.lang.StringHelper"; +obj461.Sig = "(Ljava/lang/String;Ljava/util/Locale;)Ljava/lang/String;"; +obj461.Type = "static"; +obj457.redirect = obj461; +obj242[31] = obj457; +MapXml.Method obj465 = new MapXml.Method(); +obj465.Name = "compareToIgnoreCase"; +obj465.Sig = "(Ljava/lang/String;)I"; +obj465.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj469 = new MapXml.Redirect(); +obj469.Class = "java.lang.StringHelper"; +obj469.Sig = "(Ljava/lang/String;Ljava/lang/String;)I"; +obj469.Type = "static"; +obj465.redirect = obj469; +obj242[32] = obj465; +MapXml.Method obj473 = new MapXml.Method(); +obj473.Name = "equalsIgnoreCase"; +obj473.Sig = "(Ljava/lang/String;)Z"; +obj473.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj477 = new MapXml.Redirect(); +obj477.Class = "java.lang.StringHelper"; +obj477.Sig = "(Ljava/lang/String;Ljava/lang/String;)Z"; +obj477.Type = "static"; +obj473.redirect = obj477; +obj242[33] = obj473; +MapXml.Method obj481 = new MapXml.Method(); +obj481.Name = "intern"; +obj481.Sig = "()Ljava/lang/String;"; +obj481.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj485 = new MapXml.Redirect(); +obj485.Name = "Intern"; +obj485.Sig = "(Ljava/lang/String;)Ljava/lang/String;"; +obj485.Type = "static"; +obj481.redirect = obj485; +obj242[34] = obj481; +MapXml.Method obj489 = new MapXml.Method(); +obj489.Name = "compareTo"; +obj489.Sig = "(Ljava/lang/String;)I"; +obj489.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj493 = new MapXml.Redirect(); +obj493.Class = "java.lang.StringHelper"; +obj493.Sig = "(Ljava/lang/String;Ljava/lang/String;)I"; +obj493.Type = "static"; +obj489.redirect = obj493; +obj242[35] = obj489; +MapXml.Method obj497 = new MapXml.Method(); +obj497.Name = "replace"; +obj497.Sig = "(CC)Ljava/lang/String;"; +obj497.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj501 = new MapXml.Redirect(); +obj501.Name = "Replace"; +obj497.redirect = obj501; +obj242[36] = obj497; +MapXml.Method obj503 = new MapXml.Method(); +obj503.Name = "getBytes"; +obj503.Sig = "()[B"; +obj503.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj507 = new MapXml.Redirect(); +obj507.Class = "java.lang.StringHelper"; obj507.Sig = "(Ljava/lang/String;)[B"; -obj507.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj511 = new MapXml.Redirect(); -obj511.Class = "StringHelper"; -obj511.Sig = "(Ljava/lang/String;Ljava/lang/String;)[B"; -obj511.Type = "static"; -obj507.redirect = obj511; -obj242[38] = obj507; -MapXml.Method obj515 = new MapXml.Method(); -obj515.Name = "subSequence"; -obj515.Sig = "(II)Ljava/lang/CharSequence;"; -obj515.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj519 = new MapXml.Redirect(); -obj519.Class = "StringHelper"; -obj519.Sig = "(Ljava/lang/String;II)Ljava/lang/Object;"; -obj519.Type = "static"; -obj515.redirect = obj519; -obj242[39] = obj515; -MapXml.Method obj523 = new MapXml.Method(); -obj523.Name = "trim"; -obj523.Sig = "()Ljava/lang/String;"; -obj523.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj527 = new MapXml.Redirect(); -obj527.Name = "Trim"; -obj523.redirect = obj527; -obj242[40] = obj523; -MapXml.Method obj529 = new MapXml.Method(); -obj529.Name = "regionMatches"; -obj529.Sig = "(ZILjava/lang/String;II)Z"; -obj529.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj533 = new MapXml.Redirect(); -obj533.Class = "StringHelper"; -obj533.Sig = "(Ljava/lang/String;ZILjava/lang/String;II)Z"; -obj533.Type = "static"; -obj529.redirect = obj533; -obj242[41] = obj529; -MapXml.Method obj537 = new MapXml.Method(); -obj537.Name = "regionMatches"; -obj537.Sig = "(ILjava/lang/String;II)Z"; -obj537.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj541 = new MapXml.Redirect(); -obj541.Class = "StringHelper"; -obj541.Sig = "(Ljava/lang/String;ILjava/lang/String;II)Z"; -obj541.Type = "static"; -obj537.redirect = obj541; -obj242[42] = obj537; -MapXml.Method obj545 = new MapXml.Method(); -obj545.Name = "getBytes"; -obj545.Sig = "(II[BI)V"; -obj545.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj549 = new MapXml.Redirect(); -obj549.Class = "StringHelper"; -obj549.Sig = "(Ljava/lang/String;II[BI)V"; -obj549.Type = "static"; -obj545.redirect = obj549; -obj242[43] = obj545; -MapXml.Method obj553 = new MapXml.Method(); -obj553.Name = "concat"; -obj553.Sig = "(Ljava/lang/String;)Ljava/lang/String;"; -obj553.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj557 = new MapXml.Redirect(); -obj557.Class = "StringHelper"; -obj557.Sig = "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;"; -obj557.Type = "static"; -obj553.redirect = obj557; -obj242[44] = obj553; -MapXml.Method obj561 = new MapXml.Method(); -obj561.Name = "copyValueOf"; -obj561.Sig = "([C)Ljava/lang/String;"; -obj561.Modifiers = (MapXml.MapModifiers)9; -MapXml.InstructionList obj565 = new MapXml.InstructionList(); -MapXml.Instruction[] obj566 = new MapXml.Instruction[1]; -MapXml.NewObj obj567 = new MapXml.NewObj(); -obj567.Class = "System.String"; -obj567.Name = ".ctor"; -obj567.Sig = "([C)V"; -obj566[0] = obj567; -obj565.invoke = obj566; -obj561.invokestatic = obj565; -obj242[45] = obj561; -MapXml.Method obj571 = new MapXml.Method(); -obj571.Name = "copyValueOf"; -obj571.Sig = "([CII)Ljava/lang/String;"; -obj571.Modifiers = (MapXml.MapModifiers)9; -MapXml.InstructionList obj575 = new MapXml.InstructionList(); -MapXml.Instruction[] obj576 = new MapXml.Instruction[1]; -MapXml.NewObj obj577 = new MapXml.NewObj(); -obj577.Class = "System.String"; -obj577.Name = ".ctor"; -obj577.Sig = "([CII)V"; -obj576[0] = obj577; -obj575.invoke = obj576; -obj571.invokestatic = obj575; -obj242[46] = obj571; -MapXml.Method obj581 = new MapXml.Method(); -obj581.Name = "zeroBasedStringValue"; -obj581.Sig = "(Ljava/lang/String;)[C"; -obj581.Modifiers = (MapXml.MapModifiers)8; -MapXml.Redirect obj585 = new MapXml.Redirect(); -obj585.Class = "StringHelper"; -obj585.Name = "GetValueField"; -obj581.redirect = obj585; -obj242[47] = obj581; +obj507.Type = "static"; +obj503.redirect = obj507; +obj242[37] = obj503; +MapXml.Method obj511 = new MapXml.Method(); +obj511.Name = "getBytes"; +obj511.Sig = "(Ljava/lang/String;)[B"; +obj511.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj515 = new MapXml.Redirect(); +obj515.Class = "java.lang.StringHelper"; +obj515.Sig = "(Ljava/lang/String;Ljava/lang/String;)[B"; +obj515.Type = "static"; +obj511.redirect = obj515; +obj242[38] = obj511; +MapXml.Method obj519 = new MapXml.Method(); +obj519.Name = "subSequence"; +obj519.Sig = "(II)Ljava/lang/CharSequence;"; +obj519.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj523 = new MapXml.Redirect(); +obj523.Class = "StringHelper"; +obj523.Sig = "(Ljava/lang/String;II)Ljava/lang/Object;"; +obj523.Type = "static"; +obj519.redirect = obj523; +obj242[39] = obj519; +MapXml.Method obj527 = new MapXml.Method(); +obj527.Name = "trim"; +obj527.Sig = "()Ljava/lang/String;"; +obj527.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj531 = new MapXml.Redirect(); +obj531.Class = "java.lang.StringHelper"; +obj531.Sig = "(Ljava/lang/String;)Ljava/lang/String;"; +obj531.Type = "static"; +obj527.redirect = obj531; +obj242[40] = obj527; +MapXml.Method obj535 = new MapXml.Method(); +obj535.Name = "regionMatches"; +obj535.Sig = "(ZILjava/lang/String;II)Z"; +obj535.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj539 = new MapXml.Redirect(); +obj539.Class = "java.lang.StringHelper"; +obj539.Sig = "(Ljava/lang/String;ZILjava/lang/String;II)Z"; +obj539.Type = "static"; +obj535.redirect = obj539; +obj242[41] = obj535; +MapXml.Method obj543 = new MapXml.Method(); +obj543.Name = "regionMatches"; +obj543.Sig = "(ILjava/lang/String;II)Z"; +obj543.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj547 = new MapXml.Redirect(); +obj547.Class = "java.lang.StringHelper"; +obj547.Sig = "(Ljava/lang/String;ILjava/lang/String;II)Z"; +obj547.Type = "static"; +obj543.redirect = obj547; +obj242[42] = obj543; +MapXml.Method obj551 = new MapXml.Method(); +obj551.Name = "getBytes"; +obj551.Sig = "(II[BI)V"; +obj551.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj555 = new MapXml.Redirect(); +obj555.Class = "java.lang.StringHelper"; +obj555.Sig = "(Ljava/lang/String;II[BI)V"; +obj555.Type = "static"; +obj551.redirect = obj555; +obj242[43] = obj551; +MapXml.Method obj559 = new MapXml.Method(); +obj559.Name = "concat"; +obj559.Sig = "(Ljava/lang/String;)Ljava/lang/String;"; +obj559.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj563 = new MapXml.Redirect(); +obj563.Class = "StringHelper"; +obj563.Sig = "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;"; +obj563.Type = "static"; +obj559.redirect = obj563; +obj242[44] = obj559; +MapXml.Method obj567 = new MapXml.Method(); +obj567.Name = "copyValueOf"; +obj567.Sig = "([C)Ljava/lang/String;"; +obj567.Modifiers = (MapXml.MapModifiers)9; +MapXml.InstructionList obj571 = new MapXml.InstructionList(); +MapXml.Instruction[] obj572 = new MapXml.Instruction[1]; +MapXml.NewObj obj573 = new MapXml.NewObj(); +obj573.Class = "System.String"; +obj573.Name = ".ctor"; +obj573.Sig = "([C)V"; +obj572[0] = obj573; +obj571.invoke = obj572; +obj567.invokestatic = obj571; +obj242[45] = obj567; +MapXml.Method obj577 = new MapXml.Method(); +obj577.Name = "copyValueOf"; +obj577.Sig = "([CII)Ljava/lang/String;"; +obj577.Modifiers = (MapXml.MapModifiers)9; +MapXml.InstructionList obj581 = new MapXml.InstructionList(); +MapXml.Instruction[] obj582 = new MapXml.Instruction[1]; +MapXml.NewObj obj583 = new MapXml.NewObj(); +obj583.Class = "System.String"; +obj583.Name = ".ctor"; +obj583.Sig = "([CII)V"; +obj582[0] = obj583; +obj581.invoke = obj582; +obj577.invokestatic = obj581; +obj242[46] = obj577; +MapXml.Method obj587 = new MapXml.Method(); +obj587.Name = "zeroBasedStringValue"; +obj587.Sig = "(Ljava/lang/String;)[C"; +obj587.Modifiers = (MapXml.MapModifiers)8; +MapXml.Redirect obj591 = new MapXml.Redirect(); +obj591.Class = "StringHelper"; +obj591.Name = "GetValueField"; +obj587.redirect = obj591; +obj242[47] = obj587; obj150.Methods = obj242; -MapXml.Field[] obj588 = new MapXml.Field[3]; -MapXml.Field obj589 = new MapXml.Field(); -obj589.Name = "count"; -obj589.Sig = "I"; -obj589.Modifiers = (MapXml.MapModifiers)0; -MapXml.Redirect obj593 = new MapXml.Redirect(); -obj593.Class = "StringHelper"; -obj593.Name = "GetCountField"; -obj593.Sig = "(Ljava/lang/String;)I"; -obj593.Type = "static"; -obj589.redirect = obj593; -obj588[0] = obj589; -MapXml.Field obj598 = new MapXml.Field(); -obj598.Name = "value"; -obj598.Sig = "[C"; -obj598.Modifiers = (MapXml.MapModifiers)0; -MapXml.Redirect obj602 = new MapXml.Redirect(); -obj602.Class = "StringHelper"; -obj602.Name = "GetValueField"; -obj602.Sig = "(Ljava/lang/String;)[C"; -obj602.Type = "static"; -obj598.redirect = obj602; -obj588[1] = obj598; -MapXml.Field obj607 = new MapXml.Field(); -obj607.Name = "offset"; -obj607.Sig = "I"; -obj607.Modifiers = (MapXml.MapModifiers)0; -MapXml.Redirect obj611 = new MapXml.Redirect(); -obj611.Class = "StringHelper"; -obj611.Name = "GetOffsetField"; -obj611.Sig = "(Ljava/lang/String;)I"; -obj611.Type = "static"; -obj607.redirect = obj611; -obj588[2] = obj607; -obj150.Fields = obj588; -MapXml.Interface[] obj616 = new MapXml.Interface[2]; -MapXml.Interface obj617 = new MapXml.Interface(); -obj617.Name = "java.lang.Comparable"; -obj616[0] = obj617; -MapXml.Interface obj619 = new MapXml.Interface(); -obj619.Name = "java.io.Serializable"; -obj616[1] = obj619; -obj150.Interfaces = obj616; +MapXml.Field[] obj594 = new MapXml.Field[4]; +MapXml.Field obj595 = new MapXml.Field(); +obj595.Name = "CASE_INSENSITIVE_ORDER"; +obj595.Sig = "Ljava/util/Comparator;"; +obj595.Modifiers = (MapXml.MapModifiers)25; +MapXml.Redirect obj599 = new MapXml.Redirect(); +obj599.Class = "StringHelper"; +obj599.Name = "GetCaseInsensitiveOrder"; +obj599.Sig = "()Ljava/lang/Object;"; +obj599.Type = "static"; +obj595.redirect = obj599; +obj594[0] = obj595; +MapXml.Field obj604 = new MapXml.Field(); +obj604.Name = "count"; +obj604.Sig = "I"; +obj604.Modifiers = (MapXml.MapModifiers)0; +MapXml.Redirect obj608 = new MapXml.Redirect(); +obj608.Class = "StringHelper"; +obj608.Name = "GetCountField"; +obj608.Sig = "(Ljava/lang/String;)I"; +obj608.Type = "static"; +obj604.redirect = obj608; +obj594[1] = obj604; +MapXml.Field obj613 = new MapXml.Field(); +obj613.Name = "value"; +obj613.Sig = "[C"; +obj613.Modifiers = (MapXml.MapModifiers)0; +MapXml.Redirect obj617 = new MapXml.Redirect(); +obj617.Class = "StringHelper"; +obj617.Name = "GetValueField"; +obj617.Sig = "(Ljava/lang/String;)[C"; +obj617.Type = "static"; +obj613.redirect = obj617; +obj594[2] = obj613; +MapXml.Field obj622 = new MapXml.Field(); +obj622.Name = "offset"; +obj622.Sig = "I"; +obj622.Modifiers = (MapXml.MapModifiers)0; +MapXml.Redirect obj626 = new MapXml.Redirect(); +obj626.Class = "StringHelper"; +obj626.Name = "GetOffsetField"; +obj626.Sig = "(Ljava/lang/String;)I"; +obj626.Type = "static"; +obj622.redirect = obj626; +obj594[3] = obj622; +obj150.Fields = obj594; +MapXml.Interface[] obj631 = new MapXml.Interface[2]; +MapXml.Interface obj632 = new MapXml.Interface(); +obj632.Name = "java.lang.Comparable"; +obj631[0] = obj632; +MapXml.Interface obj634 = new MapXml.Interface(); +obj634.Name = "java.io.Serializable"; +obj631[1] = obj634; +obj150.Interfaces = obj631; obj1[1] = obj150; -MapXml.Class obj621 = new MapXml.Class(); -obj621.Name = "java.lang.StringBuffer"; -obj621.Type = "System.Text.StringBuilder"; -obj621.Modifiers = (MapXml.MapModifiers)17; -MapXml.Constructor[] obj625 = new MapXml.Constructor[3]; -MapXml.Constructor obj626 = new MapXml.Constructor(); -obj626.Sig = "()V"; -obj626.Modifiers = (MapXml.MapModifiers)1; -obj625[0] = obj626; -MapXml.Constructor obj629 = new MapXml.Constructor(); -obj629.Sig = "(Ljava/lang/String;)V"; -obj629.Modifiers = (MapXml.MapModifiers)1; -obj625[1] = obj629; -MapXml.Constructor obj632 = new MapXml.Constructor(); -obj632.Sig = "(I)V"; -obj632.Modifiers = (MapXml.MapModifiers)1; -obj625[2] = obj632; -obj621.Constructors = obj625; -MapXml.Method[] obj635 = new MapXml.Method[22]; -MapXml.Method obj636 = new MapXml.Method(); -obj636.Name = "length"; -obj636.Sig = "()I"; -obj636.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj640 = new MapXml.Redirect(); -obj640.Name = "get_Length"; -obj636.redirect = obj640; -obj635[0] = obj636; -MapXml.Method obj642 = new MapXml.Method(); -obj642.Name = "setLength"; -obj642.Sig = "(I)V"; -obj642.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj646 = new MapXml.Redirect(); -obj646.Name = "set_Length"; -obj642.redirect = obj646; -obj635[1] = obj642; -MapXml.Method obj648 = new MapXml.Method(); -obj648.Name = "ensureCapacity"; -obj648.Sig = "(I)V"; -obj648.Modifiers = (MapXml.MapModifiers)1; -MapXml.InstructionList obj652 = new MapXml.InstructionList(); -MapXml.Instruction[] obj653 = new MapXml.Instruction[2]; -MapXml.Call obj654 = new MapXml.Call(); -obj654.Class = "System.Text.StringBuilder"; -obj654.Name = "EnsureCapacity"; -obj653[0] = obj654; -MapXml.Pop obj657 = new MapXml.Pop(); -obj653[1] = obj657; -obj652.invoke = obj653; -obj648.invokevirtual = obj652; -MapXml.InstructionList obj658 = new MapXml.InstructionList(); -MapXml.Instruction[] obj659 = new MapXml.Instruction[2]; -MapXml.Call obj660 = new MapXml.Call(); -obj660.Class = "System.Text.StringBuilder"; -obj660.Name = "EnsureCapacity"; -obj659[0] = obj660; -MapXml.Pop obj663 = new MapXml.Pop(); -obj659[1] = obj663; -obj658.invoke = obj659; -obj648.invokespecial = obj658; -obj635[2] = obj648; -MapXml.Method obj664 = new MapXml.Method(); -obj664.Name = "append"; -obj664.Sig = "(Ljava/lang/Object;)Ljava/lang/StringBuffer;"; -obj664.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj668 = new MapXml.Redirect(); -obj668.Class = "StringBufferHelper"; -obj668.Sig = "(Ljava/lang/StringBuffer;Ljava/lang/Object;)Ljava/lang/StringBuffer;"; -obj668.Type = "static"; -obj664.redirect = obj668; -obj635[3] = obj664; -MapXml.Method obj672 = new MapXml.Method(); -obj672.Name = "append"; -obj672.Sig = "(Ljava/lang/String;)Ljava/lang/StringBuffer;"; -obj672.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj676 = new MapXml.Redirect(); -obj676.Class = "StringBufferHelper"; -obj676.Sig = "(Ljava/lang/StringBuffer;Ljava/lang/String;)Ljava/lang/StringBuffer;"; -obj676.Type = "static"; -obj672.redirect = obj676; -obj635[4] = obj672; -MapXml.Method obj680 = new MapXml.Method(); -obj680.Name = "append"; -obj680.Sig = "(Z)Ljava/lang/StringBuffer;"; -obj680.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj684 = new MapXml.Redirect(); -obj684.Class = "StringBufferHelper"; -obj684.Sig = "(Ljava/lang/StringBuffer;Z)Ljava/lang/StringBuffer;"; -obj684.Type = "static"; -obj680.redirect = obj684; -obj635[5] = obj680; -MapXml.Method obj688 = new MapXml.Method(); -obj688.Name = "append"; -obj688.Sig = "(C)Ljava/lang/StringBuffer;"; -obj688.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj692 = new MapXml.Redirect(); -obj692.Name = "Append"; -obj688.redirect = obj692; -obj635[6] = obj688; -MapXml.Method obj694 = new MapXml.Method(); -obj694.Name = "append"; -obj694.Sig = "(I)Ljava/lang/StringBuffer;"; -obj694.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj698 = new MapXml.Redirect(); -obj698.Name = "Append"; -obj694.redirect = obj698; -obj635[7] = obj694; -MapXml.Method obj700 = new MapXml.Method(); -obj700.Name = "append"; -obj700.Sig = "(J)Ljava/lang/StringBuffer;"; -obj700.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj704 = new MapXml.Redirect(); -obj704.Name = "Append"; -obj700.redirect = obj704; -obj635[8] = obj700; -MapXml.Method obj706 = new MapXml.Method(); -obj706.Name = "append"; -obj706.Sig = "(F)Ljava/lang/StringBuffer;"; -obj706.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj710 = new MapXml.Redirect(); -obj710.Class = "StringBufferHelper"; -obj710.Sig = "(Ljava/lang/StringBuffer;F)Ljava/lang/StringBuffer;"; -obj710.Type = "static"; -obj706.redirect = obj710; -obj635[9] = obj706; -MapXml.Method obj714 = new MapXml.Method(); -obj714.Name = "append"; -obj714.Sig = "(D)Ljava/lang/StringBuffer;"; -obj714.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj718 = new MapXml.Redirect(); -obj718.Class = "StringBufferHelper"; -obj718.Sig = "(Ljava/lang/StringBuffer;D)Ljava/lang/StringBuffer;"; -obj718.Type = "static"; -obj714.redirect = obj718; -obj635[10] = obj714; -MapXml.Method obj722 = new MapXml.Method(); -obj722.Name = "append"; -obj722.Sig = "([C)Ljava/lang/StringBuffer;"; -obj722.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj726 = new MapXml.Redirect(); -obj726.Name = "Append"; -obj722.redirect = obj726; -obj635[11] = obj722; -MapXml.Method obj728 = new MapXml.Method(); -obj728.Name = "append"; -obj728.Sig = "([CII)Ljava/lang/StringBuffer;"; -obj728.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj732 = new MapXml.Redirect(); -obj732.Name = "Append"; -obj728.redirect = obj732; -obj635[12] = obj728; -MapXml.Method obj734 = new MapXml.Method(); -obj734.Name = "insert"; -obj734.Sig = "(IC)Ljava/lang/StringBuffer;"; -obj734.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj738 = new MapXml.Redirect(); -obj738.Name = "Insert"; -obj734.redirect = obj738; -obj635[13] = obj734; -MapXml.Method obj740 = new MapXml.Method(); -obj740.Name = "insert"; -obj740.Sig = "(ILjava/lang/String;)Ljava/lang/StringBuffer;"; -obj740.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj744 = new MapXml.Redirect(); -obj744.Class = "StringBufferHelper"; -obj744.Sig = "(Ljava/lang/StringBuffer;ILjava/lang/String;)Ljava/lang/StringBuffer;"; -obj744.Type = "static"; -obj740.redirect = obj744; -obj635[14] = obj740; -MapXml.Method obj748 = new MapXml.Method(); -obj748.Name = "replace"; -obj748.Sig = "(IILjava/lang/String;)Ljava/lang/StringBuffer;"; -obj748.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj752 = new MapXml.Redirect(); -obj752.Class = "StringBufferHelper"; -obj752.Sig = "(Ljava/lang/StringBuffer;IILjava/lang/String;)Ljava/lang/StringBuffer;"; -obj752.Type = "static"; -obj748.redirect = obj752; -obj635[15] = obj748; -MapXml.Method obj756 = new MapXml.Method(); -obj756.Name = "delete"; -obj756.Sig = "(II)Ljava/lang/StringBuffer;"; -obj756.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj760 = new MapXml.Redirect(); -obj760.Class = "StringBufferHelper"; -obj760.Sig = "(Ljava/lang/StringBuffer;II)Ljava/lang/StringBuffer;"; -obj760.Type = "static"; -obj756.redirect = obj760; -obj635[16] = obj756; -MapXml.Method obj764 = new MapXml.Method(); -obj764.Name = "setCharAt"; -obj764.Sig = "(IC)V"; -obj764.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj768 = new MapXml.Redirect(); -obj768.Name = "set_Chars"; -obj764.redirect = obj768; -obj635[17] = obj764; -MapXml.Method obj770 = new MapXml.Method(); -obj770.Name = "charAt"; -obj770.Sig = "(I)C"; -obj770.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj774 = new MapXml.Redirect(); -obj774.Name = "get_Chars"; -obj770.redirect = obj774; -obj635[18] = obj770; -MapXml.Method obj776 = new MapXml.Method(); -obj776.Name = "getChars"; -obj776.Sig = "(II[CI)V"; -obj776.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj780 = new MapXml.Redirect(); -obj780.Class = "StringBufferHelper"; -obj780.Sig = "(Ljava/lang/StringBuffer;II[CI)V"; -obj780.Type = "static"; -obj776.redirect = obj780; -obj635[19] = obj776; -MapXml.Method obj784 = new MapXml.Method(); -obj784.Name = "substring"; -obj784.Sig = "(II)Ljava/lang/String;"; -obj784.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj788 = new MapXml.Redirect(); -obj788.Class = "StringBufferHelper"; -obj788.Sig = "(Ljava/lang/StringBuffer;II)Ljava/lang/String;"; -obj788.Type = "static"; -obj784.redirect = obj788; -obj635[20] = obj784; -MapXml.Method obj792 = new MapXml.Method(); -obj792.Name = "substring"; -obj792.Sig = "(I)Ljava/lang/String;"; -obj792.Modifiers = (MapXml.MapModifiers)1; -MapXml.Redirect obj796 = new MapXml.Redirect(); -obj796.Class = "StringBufferHelper"; -obj796.Sig = "(Ljava/lang/StringBuffer;I)Ljava/lang/String;"; -obj796.Type = "static"; -obj792.redirect = obj796; -obj635[21] = obj792; -obj621.Methods = obj635; -obj1[2] = obj621; -MapXml.Class obj800 = new MapXml.Class(); -obj800.Name = "java.lang.Throwable"; -obj800.Type = "System.Exception"; -obj800.Modifiers = (MapXml.MapModifiers)1; -MapXml.Constructor[] obj804 = new MapXml.Constructor[4]; -MapXml.Constructor obj805 = new MapXml.Constructor(); -obj805.Sig = "()V"; -obj805.Modifiers = (MapXml.MapModifiers)1; -MapXml.InstructionList obj808 = new MapXml.InstructionList(); -MapXml.Instruction[] obj809 = new MapXml.Instruction[2]; -MapXml.Call obj810 = new MapXml.Call(); -obj810.Class = "ExceptionHelper"; -obj810.Name = "get_NullString"; -obj809[0] = obj810; -MapXml.Call obj813 = new MapXml.Call(); -obj813.Class = "System.Exception"; -obj813.Name = ".ctor"; -obj813.Sig = "(Ljava/lang/String;)V"; -obj809[1] = obj813; -obj808.invoke = obj809; -obj805.invokespecial = obj808; -obj804[0] = obj805; -MapXml.Constructor obj817 = new MapXml.Constructor(); -obj817.Sig = "(Ljava/lang/String;)V"; -obj817.Modifiers = (MapXml.MapModifiers)1; -MapXml.InstructionList obj820 = new MapXml.InstructionList(); -MapXml.Instruction[] obj821 = new MapXml.Instruction[2]; -MapXml.Call obj822 = new MapXml.Call(); -obj822.Class = "ExceptionHelper"; -obj822.Name = "FilterMessage"; -obj821[0] = obj822; +MapXml.Class obj636 = new MapXml.Class(); +obj636.Name = "java.lang.StringBuffer"; +obj636.Type = "System.Text.StringBuilder"; +obj636.Modifiers = (MapXml.MapModifiers)17; +MapXml.Constructor[] obj640 = new MapXml.Constructor[3]; +MapXml.Constructor obj641 = new MapXml.Constructor(); +obj641.Sig = "()V"; +obj641.Modifiers = (MapXml.MapModifiers)1; +obj640[0] = obj641; +MapXml.Constructor obj644 = new MapXml.Constructor(); +obj644.Sig = "(Ljava/lang/String;)V"; +obj644.Modifiers = (MapXml.MapModifiers)1; +obj640[1] = obj644; +MapXml.Constructor obj647 = new MapXml.Constructor(); +obj647.Sig = "(I)V"; +obj647.Modifiers = (MapXml.MapModifiers)1; +obj640[2] = obj647; +obj636.Constructors = obj640; +MapXml.Method[] obj650 = new MapXml.Method[22]; +MapXml.Method obj651 = new MapXml.Method(); +obj651.Name = "length"; +obj651.Sig = "()I"; +obj651.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj655 = new MapXml.Redirect(); +obj655.Name = "get_Length"; +obj651.redirect = obj655; +obj650[0] = obj651; +MapXml.Method obj657 = new MapXml.Method(); +obj657.Name = "setLength"; +obj657.Sig = "(I)V"; +obj657.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj661 = new MapXml.Redirect(); +obj661.Name = "set_Length"; +obj657.redirect = obj661; +obj650[1] = obj657; +MapXml.Method obj663 = new MapXml.Method(); +obj663.Name = "ensureCapacity"; +obj663.Sig = "(I)V"; +obj663.Modifiers = (MapXml.MapModifiers)1; +MapXml.InstructionList obj667 = new MapXml.InstructionList(); +MapXml.Instruction[] obj668 = new MapXml.Instruction[2]; +MapXml.Call obj669 = new MapXml.Call(); +obj669.Class = "System.Text.StringBuilder"; +obj669.Name = "EnsureCapacity"; +obj668[0] = obj669; +MapXml.Pop obj672 = new MapXml.Pop(); +obj668[1] = obj672; +obj667.invoke = obj668; +obj663.invokevirtual = obj667; +MapXml.InstructionList obj673 = new MapXml.InstructionList(); +MapXml.Instruction[] obj674 = new MapXml.Instruction[2]; +MapXml.Call obj675 = new MapXml.Call(); +obj675.Class = "System.Text.StringBuilder"; +obj675.Name = "EnsureCapacity"; +obj674[0] = obj675; +MapXml.Pop obj678 = new MapXml.Pop(); +obj674[1] = obj678; +obj673.invoke = obj674; +obj663.invokespecial = obj673; +obj650[2] = obj663; +MapXml.Method obj679 = new MapXml.Method(); +obj679.Name = "append"; +obj679.Sig = "(Ljava/lang/Object;)Ljava/lang/StringBuffer;"; +obj679.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj683 = new MapXml.Redirect(); +obj683.Class = "StringBufferHelper"; +obj683.Sig = "(Ljava/lang/StringBuffer;Ljava/lang/Object;)Ljava/lang/StringBuffer;"; +obj683.Type = "static"; +obj679.redirect = obj683; +obj650[3] = obj679; +MapXml.Method obj687 = new MapXml.Method(); +obj687.Name = "append"; +obj687.Sig = "(Ljava/lang/String;)Ljava/lang/StringBuffer;"; +obj687.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj691 = new MapXml.Redirect(); +obj691.Class = "StringBufferHelper"; +obj691.Sig = "(Ljava/lang/StringBuffer;Ljava/lang/String;)Ljava/lang/StringBuffer;"; +obj691.Type = "static"; +obj687.redirect = obj691; +obj650[4] = obj687; +MapXml.Method obj695 = new MapXml.Method(); +obj695.Name = "append"; +obj695.Sig = "(Z)Ljava/lang/StringBuffer;"; +obj695.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj699 = new MapXml.Redirect(); +obj699.Class = "StringBufferHelper"; +obj699.Sig = "(Ljava/lang/StringBuffer;Z)Ljava/lang/StringBuffer;"; +obj699.Type = "static"; +obj695.redirect = obj699; +obj650[5] = obj695; +MapXml.Method obj703 = new MapXml.Method(); +obj703.Name = "append"; +obj703.Sig = "(C)Ljava/lang/StringBuffer;"; +obj703.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj707 = new MapXml.Redirect(); +obj707.Name = "Append"; +obj703.redirect = obj707; +obj650[6] = obj703; +MapXml.Method obj709 = new MapXml.Method(); +obj709.Name = "append"; +obj709.Sig = "(I)Ljava/lang/StringBuffer;"; +obj709.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj713 = new MapXml.Redirect(); +obj713.Name = "Append"; +obj709.redirect = obj713; +obj650[7] = obj709; +MapXml.Method obj715 = new MapXml.Method(); +obj715.Name = "append"; +obj715.Sig = "(J)Ljava/lang/StringBuffer;"; +obj715.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj719 = new MapXml.Redirect(); +obj719.Name = "Append"; +obj715.redirect = obj719; +obj650[8] = obj715; +MapXml.Method obj721 = new MapXml.Method(); +obj721.Name = "append"; +obj721.Sig = "(F)Ljava/lang/StringBuffer;"; +obj721.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj725 = new MapXml.Redirect(); +obj725.Class = "StringBufferHelper"; +obj725.Sig = "(Ljava/lang/StringBuffer;F)Ljava/lang/StringBuffer;"; +obj725.Type = "static"; +obj721.redirect = obj725; +obj650[9] = obj721; +MapXml.Method obj729 = new MapXml.Method(); +obj729.Name = "append"; +obj729.Sig = "(D)Ljava/lang/StringBuffer;"; +obj729.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj733 = new MapXml.Redirect(); +obj733.Class = "StringBufferHelper"; +obj733.Sig = "(Ljava/lang/StringBuffer;D)Ljava/lang/StringBuffer;"; +obj733.Type = "static"; +obj729.redirect = obj733; +obj650[10] = obj729; +MapXml.Method obj737 = new MapXml.Method(); +obj737.Name = "append"; +obj737.Sig = "([C)Ljava/lang/StringBuffer;"; +obj737.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj741 = new MapXml.Redirect(); +obj741.Name = "Append"; +obj737.redirect = obj741; +obj650[11] = obj737; +MapXml.Method obj743 = new MapXml.Method(); +obj743.Name = "append"; +obj743.Sig = "([CII)Ljava/lang/StringBuffer;"; +obj743.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj747 = new MapXml.Redirect(); +obj747.Name = "Append"; +obj743.redirect = obj747; +obj650[12] = obj743; +MapXml.Method obj749 = new MapXml.Method(); +obj749.Name = "insert"; +obj749.Sig = "(IC)Ljava/lang/StringBuffer;"; +obj749.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj753 = new MapXml.Redirect(); +obj753.Name = "Insert"; +obj749.redirect = obj753; +obj650[13] = obj749; +MapXml.Method obj755 = new MapXml.Method(); +obj755.Name = "insert"; +obj755.Sig = "(ILjava/lang/String;)Ljava/lang/StringBuffer;"; +obj755.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj759 = new MapXml.Redirect(); +obj759.Class = "StringBufferHelper"; +obj759.Sig = "(Ljava/lang/StringBuffer;ILjava/lang/String;)Ljava/lang/StringBuffer;"; +obj759.Type = "static"; +obj755.redirect = obj759; +obj650[14] = obj755; +MapXml.Method obj763 = new MapXml.Method(); +obj763.Name = "replace"; +obj763.Sig = "(IILjava/lang/String;)Ljava/lang/StringBuffer;"; +obj763.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj767 = new MapXml.Redirect(); +obj767.Class = "StringBufferHelper"; +obj767.Sig = "(Ljava/lang/StringBuffer;IILjava/lang/String;)Ljava/lang/StringBuffer;"; +obj767.Type = "static"; +obj763.redirect = obj767; +obj650[15] = obj763; +MapXml.Method obj771 = new MapXml.Method(); +obj771.Name = "delete"; +obj771.Sig = "(II)Ljava/lang/StringBuffer;"; +obj771.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj775 = new MapXml.Redirect(); +obj775.Class = "StringBufferHelper"; +obj775.Sig = "(Ljava/lang/StringBuffer;II)Ljava/lang/StringBuffer;"; +obj775.Type = "static"; +obj771.redirect = obj775; +obj650[16] = obj771; +MapXml.Method obj779 = new MapXml.Method(); +obj779.Name = "setCharAt"; +obj779.Sig = "(IC)V"; +obj779.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj783 = new MapXml.Redirect(); +obj783.Name = "set_Chars"; +obj779.redirect = obj783; +obj650[17] = obj779; +MapXml.Method obj785 = new MapXml.Method(); +obj785.Name = "charAt"; +obj785.Sig = "(I)C"; +obj785.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj789 = new MapXml.Redirect(); +obj789.Name = "get_Chars"; +obj785.redirect = obj789; +obj650[18] = obj785; +MapXml.Method obj791 = new MapXml.Method(); +obj791.Name = "getChars"; +obj791.Sig = "(II[CI)V"; +obj791.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj795 = new MapXml.Redirect(); +obj795.Class = "StringBufferHelper"; +obj795.Sig = "(Ljava/lang/StringBuffer;II[CI)V"; +obj795.Type = "static"; +obj791.redirect = obj795; +obj650[19] = obj791; +MapXml.Method obj799 = new MapXml.Method(); +obj799.Name = "substring"; +obj799.Sig = "(II)Ljava/lang/String;"; +obj799.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj803 = new MapXml.Redirect(); +obj803.Class = "StringBufferHelper"; +obj803.Sig = "(Ljava/lang/StringBuffer;II)Ljava/lang/String;"; +obj803.Type = "static"; +obj799.redirect = obj803; +obj650[20] = obj799; +MapXml.Method obj807 = new MapXml.Method(); +obj807.Name = "substring"; +obj807.Sig = "(I)Ljava/lang/String;"; +obj807.Modifiers = (MapXml.MapModifiers)1; +MapXml.Redirect obj811 = new MapXml.Redirect(); +obj811.Class = "StringBufferHelper"; +obj811.Sig = "(Ljava/lang/StringBuffer;I)Ljava/lang/String;"; +obj811.Type = "static"; +obj807.redirect = obj811; +obj650[21] = obj807; +obj636.Methods = obj650; +obj1[2] = obj636; +MapXml.Class obj815 = new MapXml.Class(); +obj815.Name = "java.lang.Throwable"; +obj815.Type = "System.Exception"; +obj815.Modifiers = (MapXml.MapModifiers)1; +MapXml.Constructor[] obj819 = new MapXml.Constructor[4]; +MapXml.Constructor obj820 = new MapXml.Constructor(); +obj820.Sig = "()V"; +obj820.Modifiers = (MapXml.MapModifiers)1; +MapXml.InstructionList obj823 = new MapXml.InstructionList(); +MapXml.Instruction[] obj824 = new MapXml.Instruction[2]; MapXml.Call obj825 = new MapXml.Call(); -obj825.Class = "System.Exception"; -obj825.Name = ".ctor"; -obj825.Sig = "(Ljava/lang/String;)V"; -obj821[1] = obj825; -obj820.invoke = obj821; -obj817.invokespecial = obj820; -obj804[1] = obj817; -MapXml.Constructor obj829 = new MapXml.Constructor(); -obj829.Sig = "(Ljava/lang/String;Ljava/lang/Throwable;)V"; -obj829.Modifiers = (MapXml.MapModifiers)1; -MapXml.InstructionList obj832 = new MapXml.InstructionList(); -MapXml.Instruction[] obj833 = new MapXml.Instruction[4]; -MapXml.StLoc obj834 = new MapXml.StLoc(); -obj834.Name = "x"; -obj834.Class = "System.Exception"; -obj833[0] = obj834; +obj825.Class = "ExceptionHelper"; +obj825.Name = "get_NullString"; +obj824[0] = obj825; +MapXml.Call obj828 = new MapXml.Call(); +obj828.Class = "System.Exception"; +obj828.Name = ".ctor"; +obj828.Sig = "(Ljava/lang/String;)V"; +obj824[1] = obj828; +obj823.invoke = obj824; +obj820.invokespecial = obj823; +obj819[0] = obj820; +MapXml.Constructor obj832 = new MapXml.Constructor(); +obj832.Sig = "(Ljava/lang/String;)V"; +obj832.Modifiers = (MapXml.MapModifiers)1; +MapXml.InstructionList obj835 = new MapXml.InstructionList(); +MapXml.Instruction[] obj836 = new MapXml.Instruction[2]; MapXml.Call obj837 = new MapXml.Call(); obj837.Class = "ExceptionHelper"; obj837.Name = "FilterMessage"; -obj833[1] = obj837; -MapXml.LdLoc obj840 = new MapXml.LdLoc(); -obj840.Name = "x"; -obj833[2] = obj840; -MapXml.Call obj842 = new MapXml.Call(); -obj842.Class = "System.Exception"; -obj842.Name = ".ctor"; -obj842.Sig = "(Ljava/lang/String;Ljava/lang/Throwable;)V"; -obj833[3] = obj842; -obj832.invoke = obj833; -obj829.invokespecial = obj832; -obj804[2] = obj829; -MapXml.Constructor obj846 = new MapXml.Constructor(); -obj846.Sig = "(Ljava/lang/Throwable;)V"; -obj846.Modifiers = (MapXml.MapModifiers)1; -MapXml.InstructionList obj849 = new MapXml.InstructionList(); -MapXml.Instruction[] obj850 = new MapXml.Instruction[5]; -MapXml.StLoc obj851 = new MapXml.StLoc(); -obj851.Name = "x"; -obj851.Class = "System.Exception"; -obj850[0] = obj851; -MapXml.LdLoc obj854 = new MapXml.LdLoc(); -obj854.Name = "x"; -obj850[1] = obj854; -MapXml.Call obj856 = new MapXml.Call(); -obj856.Class = "ExceptionHelper"; -obj856.Name = "GetMessageFromCause"; -obj850[2] = obj856; -MapXml.LdLoc obj859 = new MapXml.LdLoc(); -obj859.Name = "x"; -obj850[3] = obj859; -MapXml.Call obj861 = new MapXml.Call(); -obj861.Class = "System.Exception"; -obj861.Name = ".ctor"; -obj861.Sig = "(Ljava/lang/String;Ljava/lang/Throwable;)V"; -obj850[4] = obj861; -obj849.invoke = obj850; -obj846.invokespecial = obj849; -obj804[3] = obj846; -obj800.Constructors = obj804; -MapXml.Method[] obj865 = new MapXml.Method[11]; -MapXml.Method obj866 = new MapXml.Method(); -obj866.Name = "printStackTrace"; -obj866.Sig = "()V"; -obj866.Modifiers = (MapXml.MapModifiers)1; -obj866.Type = "virtual"; -MapXml.Redirect obj871 = new MapXml.Redirect(); -obj871.Class = "ExceptionHelper"; -obj871.Sig = "(Ljava/lang/Throwable;)V"; -obj871.Type = "static"; -obj866.redirect = obj871; +obj836[0] = obj837; +MapXml.Call obj840 = new MapXml.Call(); +obj840.Class = "System.Exception"; +obj840.Name = ".ctor"; +obj840.Sig = "(Ljava/lang/String;)V"; +obj836[1] = obj840; +obj835.invoke = obj836; +obj832.invokespecial = obj835; +obj819[1] = obj832; +MapXml.Constructor obj844 = new MapXml.Constructor(); +obj844.Sig = "(Ljava/lang/String;Ljava/lang/Throwable;)V"; +obj844.Modifiers = (MapXml.MapModifiers)1; +MapXml.InstructionList obj847 = new MapXml.InstructionList(); +MapXml.Instruction[] obj848 = new MapXml.Instruction[4]; +MapXml.StLoc obj849 = new MapXml.StLoc(); +obj849.Name = "x"; +obj849.Class = "System.Exception"; +obj848[0] = obj849; +MapXml.Call obj852 = new MapXml.Call(); +obj852.Class = "ExceptionHelper"; +obj852.Name = "FilterMessage"; +obj848[1] = obj852; +MapXml.LdLoc obj855 = new MapXml.LdLoc(); +obj855.Name = "x"; +obj848[2] = obj855; +MapXml.Call obj857 = new MapXml.Call(); +obj857.Class = "System.Exception"; +obj857.Name = ".ctor"; +obj857.Sig = "(Ljava/lang/String;Ljava/lang/Throwable;)V"; +obj848[3] = obj857; +obj847.invoke = obj848; +obj844.invokespecial = obj847; +obj819[2] = obj844; +MapXml.Constructor obj861 = new MapXml.Constructor(); +obj861.Sig = "(Ljava/lang/Throwable;)V"; +obj861.Modifiers = (MapXml.MapModifiers)1; +MapXml.InstructionList obj864 = new MapXml.InstructionList(); +MapXml.Instruction[] obj865 = new MapXml.Instruction[5]; +MapXml.StLoc obj866 = new MapXml.StLoc(); +obj866.Name = "x"; +obj866.Class = "System.Exception"; obj865[0] = obj866; -MapXml.Method obj875 = new MapXml.Method(); -obj875.Name = "printStackTrace"; -obj875.Sig = "(Ljava/io/PrintStream;)V"; -obj875.Modifiers = (MapXml.MapModifiers)1; -obj875.Type = "virtual"; -MapXml.Redirect obj880 = new MapXml.Redirect(); -obj880.Class = "ExceptionHelper"; -obj880.Sig = "(Ljava/lang/Throwable;Ljava/lang/Object;)V"; -obj880.Type = "static"; -obj875.redirect = obj880; -obj865[1] = obj875; -MapXml.Method obj884 = new MapXml.Method(); -obj884.Name = "printStackTrace"; -obj884.Sig = "(Ljava/io/PrintWriter;)V"; -obj884.Modifiers = (MapXml.MapModifiers)1; -obj884.Type = "virtual"; -MapXml.Redirect obj889 = new MapXml.Redirect(); -obj889.Class = "ExceptionHelper"; -obj889.Sig = "(Ljava/lang/Throwable;Ljava/lang/Object;)V"; -obj889.Type = "static"; -obj884.redirect = obj889; -obj865[2] = obj884; -MapXml.Method obj893 = new MapXml.Method(); -obj893.Name = "getMessage"; -obj893.Sig = "()Ljava/lang/String;"; -obj893.Modifiers = (MapXml.MapModifiers)1; -obj893.Type = "virtual"; -MapXml.Redirect obj898 = new MapXml.Redirect(); -obj898.Class = "ExceptionHelper"; -obj898.Sig = "(Ljava/lang/Throwable;)Ljava/lang/String;"; -obj898.Type = "static"; -obj893.redirect = obj898; -obj865[3] = obj893; -MapXml.Method obj902 = new MapXml.Method(); -obj902.Name = "getLocalizedMessage"; -obj902.Sig = "()Ljava/lang/String;"; -obj902.Modifiers = (MapXml.MapModifiers)1; -obj902.Type = "virtual"; -MapXml.Redirect obj907 = new MapXml.Redirect(); -obj907.Class = "ExceptionHelper"; -obj907.Sig = "(Ljava/lang/Throwable;)Ljava/lang/String;"; -obj907.Type = "static"; -obj902.redirect = obj907; -obj865[4] = obj902; -MapXml.Method obj911 = new MapXml.Method(); -obj911.Name = "fillInStackTrace"; -obj911.Sig = "()Ljava/lang/Throwable;"; -obj911.Modifiers = (MapXml.MapModifiers)1; -obj911.Type = "virtual"; -MapXml.Redirect obj916 = new MapXml.Redirect(); -obj916.Class = "ExceptionHelper"; -obj916.Sig = "(Ljava/lang/Throwable;)Ljava/lang/Throwable;"; -obj916.Type = "static"; -obj911.redirect = obj916; -obj865[5] = obj911; -MapXml.Method obj920 = new MapXml.Method(); -obj920.Name = "initCause"; -obj920.Sig = "(Ljava/lang/Throwable;)Ljava/lang/Throwable;"; -obj920.Modifiers = (MapXml.MapModifiers)1; -obj920.Type = "virtual"; -MapXml.Redirect obj925 = new MapXml.Redirect(); -obj925.Class = "ExceptionHelper"; -obj925.Sig = "(Ljava/lang/Throwable;Ljava/lang/Throwable;)Ljava/lang/Throwable;"; -obj925.Type = "static"; -obj920.redirect = obj925; -obj865[6] = obj920; -MapXml.Method obj929 = new MapXml.Method(); -obj929.Name = "getCause"; -obj929.Sig = "()Ljava/lang/Throwable;"; -obj929.Modifiers = (MapXml.MapModifiers)1; -obj929.Type = "virtual"; -MapXml.Redirect obj934 = new MapXml.Redirect(); -obj934.Class = "ExceptionHelper"; -obj934.Sig = "(Ljava/lang/Throwable;)Ljava/lang/Throwable;"; -obj934.Type = "static"; -obj929.redirect = obj934; -obj865[7] = obj929; -MapXml.Method obj938 = new MapXml.Method(); -obj938.Name = "getStackTrace"; -obj938.Sig = "()[Ljava/lang/StackTraceElement;"; -obj938.Modifiers = (MapXml.MapModifiers)1; -obj938.Type = "virtual"; -MapXml.Redirect obj943 = new MapXml.Redirect(); -obj943.Class = "ExceptionHelper"; -obj943.Sig = "(Ljava/lang/Throwable;)[Ljava/lang/StackTraceElement;"; -obj943.Type = "static"; -obj938.redirect = obj943; -obj865[8] = obj938; -MapXml.Method obj947 = new MapXml.Method(); -obj947.Name = "setStackTrace"; -obj947.Sig = "([Ljava/lang/StackTraceElement;)V"; -obj947.Modifiers = (MapXml.MapModifiers)1; -obj947.Type = "virtual"; -MapXml.Redirect obj952 = new MapXml.Redirect(); -obj952.Class = "ExceptionHelper"; -obj952.Sig = "(Ljava/lang/Throwable;[Ljava/lang/StackTraceElement;)V"; -obj952.Type = "static"; -obj947.redirect = obj952; -obj865[9] = obj947; -MapXml.Method obj956 = new MapXml.Method(); -obj956.Name = "toString"; -obj956.Sig = "()Ljava/lang/String;"; -obj956.Modifiers = (MapXml.MapModifiers)1; -obj956.Type = "virtual"; -MapXml.Redirect obj961 = new MapXml.Redirect(); -obj961.Class = "ExceptionHelper"; -obj961.Sig = "(Ljava/lang/Throwable;)Ljava/lang/String;"; -obj961.Type = "static"; -obj956.redirect = obj961; -obj865[10] = obj956; -obj800.Methods = obj865; -obj1[3] = obj800; -MapXml.Class obj965 = new MapXml.Class(); -obj965.Name = "java.lang.Comparable"; -obj965.Type = "System.IComparable"; -obj965.Modifiers = (MapXml.MapModifiers)513; -MapXml.Method[] obj969 = new MapXml.Method[1]; -MapXml.Method obj970 = new MapXml.Method(); -obj970.Name = "compareTo"; -obj970.Sig = "(Ljava/lang/Object;)I"; -obj970.Modifiers = (MapXml.MapModifiers)1; -MapXml.Override obj974 = new MapXml.Override(); -obj974.Name = "CompareTo"; -obj970.@override = obj974; -obj969[0] = obj970; -obj965.Methods = obj969; -obj1[4] = obj965; -MapXml.Class obj976 = new MapXml.Class(); -obj976.Name = "java.lang.StackTraceElement"; -obj976.Type = "java.lang.StackTraceElement"; -obj976.Modifiers = (MapXml.MapModifiers)17; -obj1[5] = obj976; -obj0.remappings = obj1; -MapXml.Class[] obj980 = new MapXml.Class[2]; -MapXml.Class obj981 = new MapXml.Class(); -obj981.Name = "java.lang.VMSystem"; -obj981.Modifiers = (MapXml.MapModifiers)0; +MapXml.LdLoc obj869 = new MapXml.LdLoc(); +obj869.Name = "x"; +obj865[1] = obj869; +MapXml.Call obj871 = new MapXml.Call(); +obj871.Class = "ExceptionHelper"; +obj871.Name = "GetMessageFromCause"; +obj865[2] = obj871; +MapXml.LdLoc obj874 = new MapXml.LdLoc(); +obj874.Name = "x"; +obj865[3] = obj874; +MapXml.Call obj876 = new MapXml.Call(); +obj876.Class = "System.Exception"; +obj876.Name = ".ctor"; +obj876.Sig = "(Ljava/lang/String;Ljava/lang/Throwable;)V"; +obj865[4] = obj876; +obj864.invoke = obj865; +obj861.invokespecial = obj864; +obj819[3] = obj861; +obj815.Constructors = obj819; +MapXml.Method[] obj880 = new MapXml.Method[11]; +MapXml.Method obj881 = new MapXml.Method(); +obj881.Name = "printStackTrace"; +obj881.Sig = "()V"; +obj881.Modifiers = (MapXml.MapModifiers)1; +obj881.Type = "virtual"; +MapXml.Redirect obj886 = new MapXml.Redirect(); +obj886.Class = "ExceptionHelper"; +obj886.Sig = "(Ljava/lang/Throwable;)V"; +obj886.Type = "static"; +obj881.redirect = obj886; +obj880[0] = obj881; +MapXml.Method obj890 = new MapXml.Method(); +obj890.Name = "printStackTrace"; +obj890.Sig = "(Ljava/io/PrintStream;)V"; +obj890.Modifiers = (MapXml.MapModifiers)1; +obj890.Type = "virtual"; +MapXml.Redirect obj895 = new MapXml.Redirect(); +obj895.Class = "ExceptionHelper"; +obj895.Sig = "(Ljava/lang/Throwable;Ljava/lang/Object;)V"; +obj895.Type = "static"; +obj890.redirect = obj895; +obj880[1] = obj890; +MapXml.Method obj899 = new MapXml.Method(); +obj899.Name = "printStackTrace"; +obj899.Sig = "(Ljava/io/PrintWriter;)V"; +obj899.Modifiers = (MapXml.MapModifiers)1; +obj899.Type = "virtual"; +MapXml.Redirect obj904 = new MapXml.Redirect(); +obj904.Class = "ExceptionHelper"; +obj904.Sig = "(Ljava/lang/Throwable;Ljava/lang/Object;)V"; +obj904.Type = "static"; +obj899.redirect = obj904; +obj880[2] = obj899; +MapXml.Method obj908 = new MapXml.Method(); +obj908.Name = "getMessage"; +obj908.Sig = "()Ljava/lang/String;"; +obj908.Modifiers = (MapXml.MapModifiers)1; +obj908.Type = "virtual"; +MapXml.Redirect obj913 = new MapXml.Redirect(); +obj913.Class = "ExceptionHelper"; +obj913.Sig = "(Ljava/lang/Throwable;)Ljava/lang/String;"; +obj913.Type = "static"; +obj908.redirect = obj913; +obj880[3] = obj908; +MapXml.Method obj917 = new MapXml.Method(); +obj917.Name = "getLocalizedMessage"; +obj917.Sig = "()Ljava/lang/String;"; +obj917.Modifiers = (MapXml.MapModifiers)1; +obj917.Type = "virtual"; +MapXml.Redirect obj922 = new MapXml.Redirect(); +obj922.Class = "ExceptionHelper"; +obj922.Sig = "(Ljava/lang/Throwable;)Ljava/lang/String;"; +obj922.Type = "static"; +obj917.redirect = obj922; +obj880[4] = obj917; +MapXml.Method obj926 = new MapXml.Method(); +obj926.Name = "fillInStackTrace"; +obj926.Sig = "()Ljava/lang/Throwable;"; +obj926.Modifiers = (MapXml.MapModifiers)1; +obj926.Type = "virtual"; +MapXml.Redirect obj931 = new MapXml.Redirect(); +obj931.Class = "ExceptionHelper"; +obj931.Sig = "(Ljava/lang/Throwable;)Ljava/lang/Throwable;"; +obj931.Type = "static"; +obj926.redirect = obj931; +obj880[5] = obj926; +MapXml.Method obj935 = new MapXml.Method(); +obj935.Name = "initCause"; +obj935.Sig = "(Ljava/lang/Throwable;)Ljava/lang/Throwable;"; +obj935.Modifiers = (MapXml.MapModifiers)1; +obj935.Type = "virtual"; +MapXml.Redirect obj940 = new MapXml.Redirect(); +obj940.Class = "ExceptionHelper"; +obj940.Sig = "(Ljava/lang/Throwable;Ljava/lang/Throwable;)Ljava/lang/Throwable;"; +obj940.Type = "static"; +obj935.redirect = obj940; +obj880[6] = obj935; +MapXml.Method obj944 = new MapXml.Method(); +obj944.Name = "getCause"; +obj944.Sig = "()Ljava/lang/Throwable;"; +obj944.Modifiers = (MapXml.MapModifiers)1; +obj944.Type = "virtual"; +MapXml.Redirect obj949 = new MapXml.Redirect(); +obj949.Class = "ExceptionHelper"; +obj949.Sig = "(Ljava/lang/Throwable;)Ljava/lang/Throwable;"; +obj949.Type = "static"; +obj944.redirect = obj949; +obj880[7] = obj944; +MapXml.Method obj953 = new MapXml.Method(); +obj953.Name = "getStackTrace"; +obj953.Sig = "()[Ljava/lang/StackTraceElement;"; +obj953.Modifiers = (MapXml.MapModifiers)1; +obj953.Type = "virtual"; +MapXml.Redirect obj958 = new MapXml.Redirect(); +obj958.Class = "ExceptionHelper"; +obj958.Sig = "(Ljava/lang/Throwable;)[Ljava/lang/StackTraceElement;"; +obj958.Type = "static"; +obj953.redirect = obj958; +obj880[8] = obj953; +MapXml.Method obj962 = new MapXml.Method(); +obj962.Name = "setStackTrace"; +obj962.Sig = "([Ljava/lang/StackTraceElement;)V"; +obj962.Modifiers = (MapXml.MapModifiers)1; +obj962.Type = "virtual"; +MapXml.Redirect obj967 = new MapXml.Redirect(); +obj967.Class = "ExceptionHelper"; +obj967.Sig = "(Ljava/lang/Throwable;[Ljava/lang/StackTraceElement;)V"; +obj967.Type = "static"; +obj962.redirect = obj967; +obj880[9] = obj962; +MapXml.Method obj971 = new MapXml.Method(); +obj971.Name = "toString"; +obj971.Sig = "()Ljava/lang/String;"; +obj971.Modifiers = (MapXml.MapModifiers)1; +obj971.Type = "virtual"; +MapXml.Redirect obj976 = new MapXml.Redirect(); +obj976.Class = "ExceptionHelper"; +obj976.Sig = "(Ljava/lang/Throwable;)Ljava/lang/String;"; +obj976.Type = "static"; +obj971.redirect = obj976; +obj880[10] = obj971; +obj815.Methods = obj880; +obj1[3] = obj815; +MapXml.Class obj980 = new MapXml.Class(); +obj980.Name = "java.lang.Comparable"; +obj980.Type = "System.IComparable"; +obj980.Modifiers = (MapXml.MapModifiers)513; MapXml.Method[] obj984 = new MapXml.Method[1]; MapXml.Method obj985 = new MapXml.Method(); -obj985.Name = "identityHashCode"; +obj985.Name = "compareTo"; obj985.Sig = "(Ljava/lang/Object;)I"; -obj985.Modifiers = (MapXml.MapModifiers)0; -MapXml.Instruction[] obj989 = new MapXml.Instruction[3]; -MapXml.LdArg_0 obj990 = new MapXml.LdArg_0(); -obj989[0] = obj990; -MapXml.Call obj991 = new MapXml.Call(); -obj991.Class = "System.Object"; -obj991.Name = "GetHashCode"; -obj989[1] = obj991; -MapXml.Ret obj994 = new MapXml.Ret(); -obj989[2] = obj994; -obj985.invoke = obj989; +obj985.Modifiers = (MapXml.MapModifiers)1; +MapXml.Override obj989 = new MapXml.Override(); +obj989.Name = "CompareTo"; +obj985.@override = obj989; obj984[0] = obj985; -obj981.Methods = obj984; -obj980[0] = obj981; -MapXml.Class obj995 = new MapXml.Class(); -obj995.Name = "java.lang.Runtime"; -obj995.Modifiers = (MapXml.MapModifiers)0; -MapXml.Method[] obj998 = new MapXml.Method[1]; -MapXml.Method obj999 = new MapXml.Method(); -obj999.Name = "execInternal"; -obj999.Sig = "([Ljava/lang/String;[Ljava/lang/String;Ljava/io/File;)Ljava/lang/Process;"; -obj999.Modifiers = (MapXml.MapModifiers)0; -MapXml.Instruction[] obj1003 = new MapXml.Instruction[6]; -MapXml.LdArg_0 obj1004 = new MapXml.LdArg_0(); -obj1003[0] = obj1004; -MapXml.LdArg_1 obj1005 = new MapXml.LdArg_1(); -obj1003[1] = obj1005; -MapXml.LdArg_2 obj1006 = new MapXml.LdArg_2(); -obj1003[2] = obj1006; -MapXml.LdArg_3 obj1007 = new MapXml.LdArg_3(); -obj1003[3] = obj1007; -MapXml.Call obj1008 = new MapXml.Call(); -obj1008.Class = "ikvm.lang.DotNetProcess"; -obj1008.Name = "execInternal"; -obj1003[4] = obj1008; -MapXml.Ret obj1011 = new MapXml.Ret(); -obj1003[5] = obj1011; -obj999.invoke = obj1003; -obj998[0] = obj999; -obj995.Methods = obj998; -obj980[1] = obj995; -obj0.nativeMethods = obj980; +obj980.Methods = obj984; +obj1[4] = obj980; +MapXml.Class obj991 = new MapXml.Class(); +obj991.Name = "java.lang.StackTraceElement"; +obj991.Type = "java.lang.StackTraceElement"; +obj991.Modifiers = (MapXml.MapModifiers)17; +obj1[5] = obj991; +obj0.remappings = obj1; +MapXml.Class[] obj995 = new MapXml.Class[2]; +MapXml.Class obj996 = new MapXml.Class(); +obj996.Name = "java.lang.VMSystem"; +obj996.Modifiers = (MapXml.MapModifiers)0; +MapXml.Method[] obj999 = new MapXml.Method[1]; +MapXml.Method obj1000 = new MapXml.Method(); +obj1000.Name = "identityHashCode"; +obj1000.Sig = "(Ljava/lang/Object;)I"; +obj1000.Modifiers = (MapXml.MapModifiers)0; +MapXml.Instruction[] obj1004 = new MapXml.Instruction[3]; +MapXml.LdArg_0 obj1005 = new MapXml.LdArg_0(); +obj1004[0] = obj1005; +MapXml.Call obj1006 = new MapXml.Call(); +obj1006.Class = "System.Object"; +obj1006.Name = "GetHashCode"; +obj1004[1] = obj1006; +MapXml.Ret obj1009 = new MapXml.Ret(); +obj1004[2] = obj1009; +obj1000.invoke = obj1004; +obj999[0] = obj1000; +obj996.Methods = obj999; +obj995[0] = obj996; +MapXml.Class obj1010 = new MapXml.Class(); +obj1010.Name = "java.lang.Runtime"; +obj1010.Modifiers = (MapXml.MapModifiers)0; +MapXml.Method[] obj1013 = new MapXml.Method[1]; +MapXml.Method obj1014 = new MapXml.Method(); +obj1014.Name = "execInternal"; +obj1014.Sig = "([Ljava/lang/String;[Ljava/lang/String;Ljava/io/File;)Ljava/lang/Process;"; +obj1014.Modifiers = (MapXml.MapModifiers)0; +MapXml.Instruction[] obj1018 = new MapXml.Instruction[6]; +MapXml.LdArg_0 obj1019 = new MapXml.LdArg_0(); +obj1018[0] = obj1019; +MapXml.LdArg_1 obj1020 = new MapXml.LdArg_1(); +obj1018[1] = obj1020; +MapXml.LdArg_2 obj1021 = new MapXml.LdArg_2(); +obj1018[2] = obj1021; +MapXml.LdArg_3 obj1022 = new MapXml.LdArg_3(); +obj1018[3] = obj1022; +MapXml.Call obj1023 = new MapXml.Call(); +obj1023.Class = "ikvm.lang.DotNetProcess"; +obj1023.Name = "execInternal"; +obj1018[4] = obj1023; +MapXml.Ret obj1026 = new MapXml.Ret(); +obj1018[5] = obj1026; +obj1014.invoke = obj1018; +obj1013[0] = obj1014; +obj1010.Methods = obj1013; +obj995[1] = obj1010; +obj0.nativeMethods = obj995; return obj0; } } diff --git a/IK.VM.NET/vm.cs b/IK.VM.NET/vm.cs index b6401c52..8b260026 100644 --- a/IK.VM.NET/vm.cs +++ b/IK.VM.NET/vm.cs @@ -34,6 +34,7 @@ public class JVM private static bool debug = false; private static bool noJniStubs = false; private static bool isStaticCompiler = false; + private static bool logClassLoadFailures = false; private static IJniProvider jniProvider; public static bool Debug @@ -64,6 +65,18 @@ public class JVM } } + public static bool LogClassLoadFailures + { + get + { + return logClassLoadFailures; + } + set + { + logClassLoadFailures = value; + } + } + public static bool CleanStackTraces { get @@ -222,7 +235,7 @@ public class JVM { Assembly.LoadFrom(r); } - Console.WriteLine("Loading remapped types"); + Console.WriteLine("Loading remapped types (1)"); loader.LoadRemappedTypes(); Console.WriteLine("Compiling class files (1)"); foreach(string s in h.Keys) @@ -253,6 +266,8 @@ public class JVM loader.SetMain(method, target); } } + Console.WriteLine("Loading remapped types (2)"); + loader.LoadRemappedTypesStep2(); Console.WriteLine("Compiling class files (2)"); loader.AddResources(resources); loader.Save(); diff --git a/awt/toolkit.cs b/awt/toolkit.cs index b0daf846..e023514c 100644 --- a/awt/toolkit.cs +++ b/awt/toolkit.cs @@ -458,6 +458,10 @@ namespace ikvm.awt { throw new NotImplementedException(); } + public bool requestFocus(java.awt.Component source, bool bool1, bool bool2, long x) + { + throw new NotImplementedException(); + } public void reshape(int x, int y, int width, int height) { throw new NotImplementedException(); @@ -524,6 +528,62 @@ namespace ikvm.awt { Console.WriteLine("NOTE: NetComponentPeer.setEventMask not implemented"); } + + public bool isObscured() + { + throw new NotImplementedException(); + } + + public bool canDetermineObscurity() + { + throw new NotImplementedException(); + } + + public void coalescePaintEvent(java.awt.@event.PaintEvent e) + { + throw new NotImplementedException(); + } + + public void updateCursorImmediately() + { + throw new NotImplementedException(); + } + + public VolatileImage createVolatileImage(int width, int height) + { + throw new NotImplementedException(); + } + + public bool handlesWheelScrolling() + { + throw new NotImplementedException(); + } + + public void createBuffers(int x, java.awt.BufferCapabilities capabilities) + { + throw new NotImplementedException(); + } + + public java.awt.Image getBackBuffer() + { + throw new NotImplementedException(); + } + + public void flip(java.awt.BufferCapabilities.FlipContents contents) + { + throw new NotImplementedException(); + } + + public void destroyBuffers() + { + throw new NotImplementedException(); + } + + public bool isFocusable() + { + // TODO + return true; + } } class NetButtonPeer : NetComponentPeer, ButtonPeer @@ -632,6 +692,18 @@ namespace ikvm.awt { throw new NotImplementedException(); } + public long filterEvents(long filter) + { + throw new NotImplementedException(); + } + public int getIndexAtPoint(int x, int y) + { + throw new NotImplementedException(); + } + public java.awt.Rectangle getCharacterBounds(int pos) + { + throw new NotImplementedException(); + } } class NetTextFieldPeer : NetTextComponentPeer, TextFieldPeer @@ -757,6 +829,18 @@ namespace ikvm.awt { Console.WriteLine("NOTE: NetContainerPeer.endValidate not implemented"); } + public void beginLayout() + { + throw new NotImplementedException(); + } + public void endLayout() + { + throw new NotImplementedException(); + } + public bool isPaintPending() + { + throw new NotImplementedException(); + } } class NetPanelPeer : NetContainerPeer, PanelPeer @@ -846,5 +930,17 @@ namespace ikvm.awt // TODO use control.Invoke return new java.awt.Insets(0, 0, control.Height - client.Height, control.Width - client.Width); } + public int getState() + { + throw new NotImplementedException(); + } + public void setState(int state) + { + throw new NotImplementedException(); + } + public void setMaximizedBounds(java.awt.Rectangle r) + { + throw new NotImplementedException(); + } } } diff --git a/classpath/allsources.lst b/classpath/allsources.lst index e1b7b7e0..011f865a 100644 --- a/classpath/allsources.lst +++ b/classpath/allsources.lst @@ -2,11 +2,9 @@ C:\ikvm\classpath\ikvm\lang\DotNetProcess.java C:\ikvm\classpath\gnu\classpath\Configuration.java C:\ikvm\classpath\gnu\java\net\protocol\ikvmres\Handler.java C:\ikvm\classpath\java\io\FileDescriptor.java -C:\ikvm\classpath\java\io\FileInputStream.java -C:\ikvm\classpath\java\io\FileOutputStream.java -C:\ikvm\classpath\java\io\RandomAccessFile.java C:\ikvm\classpath\java\lang\Thread.java C:\ikvm\classpath\java\lang\Class.java +C:\ikvm\classpath\java\lang\StringHelper.java C:\ikvm\classpath\java\lang\VMClassLoader.java C:\ikvm\classpath\java\lang\reflect\Constructor.java C:\ikvm\classpath\java\lang\reflect\Method.java @@ -220,6 +218,7 @@ C:\classpath\gnu\java\nio\CharBufferImpl.java C:\classpath\gnu\java\nio\DatagramChannelImpl.java C:\classpath\gnu\java\nio\DoubleBufferImpl.java C:\classpath\gnu\java\nio\FileChannelImpl.java +C:\classpath\gnu\java\nio\FileLockImpl.java C:\classpath\gnu\java\nio\FloatBufferImpl.java C:\classpath\gnu\java\nio\IntBufferImpl.java C:\classpath\gnu\java\nio\LongBufferImpl.java @@ -429,6 +428,7 @@ C:\classpath\java\awt\datatransfer\Transferable.java C:\classpath\java\awt\datatransfer\UnsupportedFlavorException.java C:\classpath\java\awt\dnd\Autoscroll.java C:\classpath\java\awt\dnd\DnDConstants.java +C:\classpath\java\awt\dnd\DnDEventMulticaster.java C:\classpath\java\awt\dnd\DragGestureEvent.java C:\classpath\java\awt\dnd\DragGestureListener.java C:\classpath\java\awt\dnd\DragGestureRecognizer.java @@ -451,6 +451,7 @@ C:\classpath\java\awt\dnd\InvalidDnDOperationException.java C:\classpath\java\awt\dnd\MouseDragGestureRecognizer.java C:\classpath\java\awt\dnd\peer\DragSourceContextPeer.java C:\classpath\java\awt\dnd\peer\DropTargetContextPeer.java +C:\classpath\java\awt\dnd\peer\DropTargetPeer.java C:\classpath\java\awt\event\ActionEvent.java C:\classpath\java\awt\event\ActionListener.java C:\classpath\java\awt\event\AdjustmentEvent.java @@ -494,7 +495,23 @@ C:\classpath\java\awt\event\WindowEvent.java C:\classpath\java\awt\event\WindowFocusListener.java C:\classpath\java\awt\event\WindowListener.java C:\classpath\java\awt\event\WindowStateListener.java +C:\classpath\java\awt\font\FontRenderContext.java +C:\classpath\java\awt\font\GlyphJustificationInfo.java +C:\classpath\java\awt\font\GlyphMetrics.java +C:\classpath\java\awt\font\GlyphVector.java +C:\classpath\java\awt\font\GraphicAttribute.java +C:\classpath\java\awt\font\ImageGraphicAttribute.java +C:\classpath\java\awt\font\LineBreakMeasurer.java +C:\classpath\java\awt\font\LineMetrics.java +C:\classpath\java\awt\font\MultipleMaster.java +C:\classpath\java\awt\font\NumericShaper.java +C:\classpath\java\awt\font\OpenType.java +C:\classpath\java\awt\font\ShapeGraphicAttribute.java +C:\classpath\java\awt\font\TextAttribute.java C:\classpath\java\awt\font\TextHitInfo.java +C:\classpath\java\awt\font\TextLayout.java +C:\classpath\java\awt\font\TextMeasurer.java +C:\classpath\java\awt\font\TransformAttribute.java C:\classpath\java\awt\geom\AffineTransform.java C:\classpath\java\awt\geom\Arc2D.java C:\classpath\java\awt\geom\Area.java @@ -581,6 +598,7 @@ C:\classpath\java\awt\peer\MenuItemPeer.java C:\classpath\java\awt\peer\MenuPeer.java C:\classpath\java\awt\peer\PanelPeer.java C:\classpath\java\awt\peer\PopupMenuPeer.java +C:\classpath\java\awt\peer\RobotPeer.java C:\classpath\java\awt\peer\ScrollbarPeer.java C:\classpath\java\awt\peer\ScrollPanePeer.java C:\classpath\java\awt\peer\TextAreaPeer.java @@ -641,6 +659,8 @@ C:\classpath\java\beans\beancontext\BeanContextServiceRevokedEvent.java C:\classpath\java\beans\beancontext\BeanContextServiceRevokedListener.java C:\classpath\java\beans\beancontext\BeanContextServices.java C:\classpath\java\beans\beancontext\BeanContextServicesListener.java +C:\classpath\java\beans\beancontext\BeanContextServicesSupport.java +C:\classpath\java\beans\beancontext\BeanContextSupport.java C:\classpath\java\io\BufferedInputStream.java C:\classpath\java\io\BufferedOutputStream.java C:\classpath\java\io\BufferedReader.java @@ -658,8 +678,10 @@ C:\classpath\java\io\EOFException.java C:\classpath\java\io\Externalizable.java C:\classpath\java\io\File.java C:\classpath\java\io\FileFilter.java +C:\classpath\java\io\FileInputStream.java C:\classpath\java\io\FilenameFilter.java C:\classpath\java\io\FileNotFoundException.java +C:\classpath\java\io\FileOutputStream.java C:\classpath\java\io\FilePermission.java C:\classpath\java\io\FileReader.java C:\classpath\java\io\FileWriter.java @@ -697,6 +719,7 @@ C:\classpath\java\io\PrintStream.java C:\classpath\java\io\PrintWriter.java C:\classpath\java\io\PushbackInputStream.java C:\classpath\java\io\PushbackReader.java +C:\classpath\java\io\RandomAccessFile.java C:\classpath\java\io\Reader.java C:\classpath\java\io\SequenceInputStream.java C:\classpath\java\io\Serializable.java @@ -1081,6 +1104,7 @@ C:\classpath\java\security\interfaces\DSAParams.java C:\classpath\java\security\interfaces\DSAPrivateKey.java C:\classpath\java\security\interfaces\DSAPublicKey.java C:\classpath\java\security\interfaces\RSAKey.java +C:\classpath\java\security\interfaces\RSAMultiPrimePrivateCrtKey.java C:\classpath\java\security\interfaces\RSAPrivateCrtKey.java C:\classpath\java\security\interfaces\RSAPrivateKey.java C:\classpath\java\security\interfaces\RSAPublicKey.java @@ -1093,7 +1117,10 @@ C:\classpath\java\security\spec\InvalidKeySpecException.java C:\classpath\java\security\spec\InvalidParameterSpecException.java C:\classpath\java\security\spec\KeySpec.java C:\classpath\java\security\spec\PKCS8EncodedKeySpec.java +C:\classpath\java\security\spec\PSSParameterSpec.java C:\classpath\java\security\spec\RSAKeyGenParameterSpec.java +C:\classpath\java\security\spec\RSAMultiPrimePrivateCrtKeySpec.java +C:\classpath\java\security\spec\RSAOtherPrimeInfo.java C:\classpath\java\security\spec\RSAPrivateCrtKeySpec.java C:\classpath\java\security\spec\RSAPrivateKeySpec.java C:\classpath\java\security\spec\RSAPublicKeySpec.java @@ -1353,6 +1380,24 @@ C:\classpath\javax\naming\directory\NoSuchAttributeException.java C:\classpath\javax\naming\directory\SchemaViolationException.java C:\classpath\javax\naming\directory\SearchControls.java C:\classpath\javax\naming\directory\SearchResult.java +C:\classpath\javax\naming\event\EventContext.java +C:\classpath\javax\naming\event\EventDirContext.java +C:\classpath\javax\naming\event\NamespaceChangeListener.java +C:\classpath\javax\naming\event\NamingEvent.java +C:\classpath\javax\naming\event\NamingExceptionEvent.java +C:\classpath\javax\naming\event\NamingListener.java +C:\classpath\javax\naming\event\ObjectChangeListener.java +C:\classpath\javax\naming\ldap\Control.java +C:\classpath\javax\naming\ldap\ControlFactory.java +C:\classpath\javax\naming\ldap\ExtendedRequest.java +C:\classpath\javax\naming\ldap\ExtendedResponse.java +C:\classpath\javax\naming\ldap\HasControls.java +C:\classpath\javax\naming\ldap\InitialLdapContext.java +C:\classpath\javax\naming\ldap\LdapContext.java +C:\classpath\javax\naming\ldap\LdapReferralException.java +C:\classpath\javax\naming\ldap\UnsolicitedNotification.java +C:\classpath\javax\naming\ldap\UnsolicitedNotificationEvent.java +C:\classpath\javax\naming\ldap\UnsolicitedNotificationListener.java C:\classpath\javax\naming\spi\DirectoryManager.java C:\classpath\javax\naming\spi\DirObjectFactory.java C:\classpath\javax\naming\spi\DirStateFactory.java @@ -1699,9 +1744,9 @@ C:\classpath\javax\transaction\xa\XAResource.java C:\classpath\javax\transaction\xa\Xid.java C:\classpath\vm\reference\gnu\vm\stack\StackFrame.java C:\classpath\vm\reference\gnu\vm\stack\StackTrace.java +C:\classpath\vm\reference\java\io\VMObjectStreamClass.java C:\classpath\vm\reference\java\lang\Runtime.java C:\classpath\vm\reference\java\lang\VMObject.java C:\classpath\vm\reference\java\lang\VMSecurityManager.java C:\classpath\vm\reference\java\lang\VMSystem.java C:\classpath\vm\reference\java\lang\VMThrowable.java -C:\classpath\vm\reference\java\io\VMObjectStreamClass.java diff --git a/classpath/java/io/FileDescriptor.java b/classpath/java/io/FileDescriptor.java index c50e1d3d..ce9c18d2 100644 --- a/classpath/java/io/FileDescriptor.java +++ b/classpath/java/io/FileDescriptor.java @@ -1,31 +1,54 @@ -/* - Copyright (C) 2002 Jeroen Frijters +/* FileDescriptor.java -- Opaque file handle class + Copyright (C) 1998,2003 Free Software Foundation, Inc. - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. +This file is part of GNU Classpath. - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - Jeroen Frijters - jeroen@frijters.net - -*/ package java.io; import system.Console; import system.io.*; +/** + * This class represents an opaque file handle as a Java class. It should + * be used only to pass to other methods that expect an object of this + * type. No system specific information can be obtained from this object. + * + * @author Aaron M. Renn (arenn@urbanophile.com) + * @author Jeroen Frijters (jeroen@sumatra.nl) + */ public final class FileDescriptor { public static final FileDescriptor in = new FileDescriptor(Console.OpenStandardInput()); @@ -96,43 +119,57 @@ public final class FileDescriptor return path; } - static final int Append = 0; // FileMode.Append, FileAccess.Write (FileOutputStream(append = true)) - static final int Write = 1; // FileMode.Create, FileAccess.Write (FileOutputStream(append = false)) - static final int Read = 2; // FileMode.Open, FileAccess.Read (FileInputStream, RandomAccessFile("r")) - static final int ReadWrite = 3; // FileMode.OpenOrCreate, FileAccess.ReadWrite (RandomAccessFile("rw")) - - static FileDescriptor open(String name, int mode) throws FileNotFoundException + synchronized void open(String path, String mode) throws IOException { + if(stream != null) + throw new IOException("FileDescriptor already open"); + if ((path == null) || path.equals("")) + throw new IllegalArgumentException("Path cannot be null"); try { int fileMode; int fileAccess; - switch(mode) + if(mode.equals("r")) { - case Append: - fileMode = FileMode.Append; - fileAccess = FileAccess.Write; - break; - case Write: - fileMode = FileMode.Create; - fileAccess = FileAccess.Write; - break; - case Read: - fileMode = FileMode.Open; - fileAccess = FileAccess.Read; - break; - case ReadWrite: - fileMode = FileMode.OpenOrCreate; - fileAccess = FileAccess.ReadWrite; - break; - default: - throw new Error("Invalid mode: " + mode); + fileMode = FileMode.Open; + fileAccess = FileAccess.Read; + } + else if(mode.equals("rw")) + { + fileMode = FileMode.OpenOrCreate; + fileAccess = FileAccess.ReadWrite; + } + else if(mode.equals("rws") || mode.equals("rwd")) + { + // TODO implement this + throw new IllegalArgumentException("rws and rwd not implemented"); + //fileMode = FileMode.OpenOrCreate; + //fileAccess = FileAccess.ReadWrite; + } + else if(mode.equals("rwa")) + { + // TODO this is a bogus mode + fileMode = FileMode.Append; + fileAccess = FileAccess.ReadWrite; + } + else if(mode.equals("w")) + { + fileMode = FileMode.Create; + fileAccess = FileAccess.Write; + } + else if(mode.equals("a")) + { + fileMode = FileMode.Append; + fileAccess = FileAccess.Write; + } + else + { + throw new IllegalArgumentException("Invalid mode value: " + mode); } if(false) throw new system.io.IOException(); if(false) throw new system.security.SecurityException(); if(false) throw new system.UnauthorizedAccessException(); - FileStream fs = system.io.File.Open(demanglePath(name), fileMode, fileAccess, FileShare.ReadWrite); - return new FileDescriptor(fs); + stream = system.io.File.Open(demanglePath(path), fileMode, fileAccess, FileShare.ReadWrite); } catch(system.security.SecurityException x1) { @@ -153,9 +190,8 @@ public final class FileDescriptor synchronized long getFilePointer() throws IOException { if(stream == null) - { - throw new IOException(); - } + throw new IOException("Invalid FileDescriptor"); + try { if(false) throw new system.io.IOException(); @@ -171,9 +207,8 @@ public final class FileDescriptor synchronized long getLength() throws IOException { if(stream == null) - { - throw new IOException(); - } + throw new IOException("Invalid FileDescriptor"); + try { if(false) throw new system.io.IOException(); @@ -186,16 +221,19 @@ public final class FileDescriptor // TODO map al the other exceptions as well... } - synchronized void setLength(long length) throws IOException + synchronized void setLength(long len) throws IOException { if(stream == null) - { - throw new IOException(); - } + throw new IOException("Invalid FileDescriptor"); + + if (len < 0) + throw new IllegalArgumentException("Length cannot be less than zero " + + len); + try { if(false) throw new system.io.IOException(); - stream.SetLength(length); + stream.SetLength(len); } catch(system.io.IOException x) { @@ -204,16 +242,27 @@ public final class FileDescriptor // TODO map al the other exceptions as well... } - synchronized void seek(long pos) throws IOException + static final int SET = SeekOrigin.Begin; + static final int CUR = SeekOrigin.Current; + static final int END = SeekOrigin.End; + + synchronized long seek(long offset, int whence, boolean stopAtEof) throws IOException { if(stream == null) - { - throw new IOException(); - } + throw new IOException("Invalid FileDescriptor"); + + if ((whence != SET) && (whence != CUR) && (whence != END)) + throw new IllegalArgumentException("Invalid whence value: " + whence); + try { if(false) throw new system.io.IOException(); - stream.Seek(pos, SeekOrigin.Begin); + long newpos = stream.Seek(offset, whence); + if(stopAtEof && newpos > stream.get_Length()) + { + newpos = stream.Seek(0, SeekOrigin.End); + } + return newpos; } catch(system.io.IOException x) { @@ -222,16 +271,15 @@ public final class FileDescriptor // TODO map al the other exceptions as well... } - synchronized int read(byte[] buf, int offset, int length) throws IOException + synchronized int read() throws IOException { if(stream == null) - { - throw new IOException(); - } + throw new IOException("Invalid FileDescriptor"); + try { if(false) throw new system.io.IOException(); - return stream.Read(buf, offset, length); + return stream.ReadByte(); } catch(system.io.IOException x) { @@ -240,16 +288,29 @@ public final class FileDescriptor // TODO map al the other exceptions as well... } - synchronized void write(byte[] buf, int offset, int length) throws IOException + synchronized int read(byte[] buf, int offset, int len) throws IOException { if(stream == null) - { - throw new IOException(); - } + throw new IOException("Invalid FileDescriptor"); + + if (len == 0) + return(0); + + if ((offset < 0) || (offset > buf.length)) + throw new IllegalArgumentException("Offset invalid: " + offset); + + if ((len < 0) || (len > (buf.length - offset))) + throw new IllegalArgumentException("Length invalid: " + len); + try { if(false) throw new system.io.IOException(); - stream.Write(buf, offset, length); + int count = stream.Read(buf, offset, len); + if(count == 0) + { + count = -1; + } + return count; } catch(system.io.IOException x) { @@ -258,19 +319,16 @@ public final class FileDescriptor // TODO map al the other exceptions as well... } - synchronized long skip(long n) throws IOException + synchronized void write(int b) throws IOException { if(stream == null) { - throw new IOException(); + throw new IOException("Invalid FileDescriptor"); } try { if(false) throw new system.io.IOException(); - // TODO this is broken, because non-seekable streams should support skip as well... - // (and I don't think we should seek past EOF here) - stream.Seek(n, SeekOrigin.Current); - return n; + stream.WriteByte((byte)b); } catch(system.io.IOException x) { @@ -278,4 +336,45 @@ public final class FileDescriptor } // TODO map al the other exceptions as well... } -} + + synchronized void write(byte[] buf, int offset, int len) throws IOException + { + if(stream == null) + throw new IOException("Invalid FileDescriptor"); + + if (len == 0) + return; + + if ((offset < 0) || (offset > buf.length)) + throw new IllegalArgumentException("Offset invalid: " + offset); + + if ((len < 0) || (len > (buf.length - offset))) + throw new IllegalArgumentException("Length invalid: " + len); + + try + { + if(false) throw new system.io.IOException(); + stream.Write(buf, offset, len); + } + catch(system.io.IOException x) + { + throw new IOException(x.get_Message()); + } + // TODO map al the other exceptions as well... + } + + synchronized int available() throws IOException + { + if(stream == null) + throw new IOException("Invalid FileDescriptor"); + + // TODO might need to implement this + return 0; + } + + long getNativeFd() + { + throw new Error("getNativeFd not supported"); + } + +} // class FileDescriptor diff --git a/classpath/java/io/FileInputStream.java b/classpath/java/io/FileInputStream.java deleted file mode 100644 index a7ad40da..00000000 --- a/classpath/java/io/FileInputStream.java +++ /dev/null @@ -1,396 +0,0 @@ -/* FileInputStream.java -- An input stream that reads from disk files. - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package java.io; - -import gnu.classpath.Configuration; -import java.nio.channels.FileChannel; -import gnu.java.nio.FileChannelImpl; - -/** - * This class is a stream that reads its bytes from a file. - * - * @version 0.0 - * - * @author Aaron M. Renn (arenn@urbanophile.com) - */ -public class FileInputStream extends InputStream -{ - -/*************************************************************************/ - -/* - * Class Variables and Initializers - */ - - static - { - if (Configuration.INIT_LOAD_LIBRARY) - { - System.loadLibrary ("javaio"); - } - } - -/*************************************************************************/ - -/* - * Instance Variables - */ - -/** - * This is the native file handle for the file this stream is reading from - */ -private FileDescriptor fd; - -/*************************************************************************/ - -/* - * Constructors - */ - -/** - * This method initializes a FileInputStream to read from the - * specified named file. A security check is first made to determine - * whether or not access to this file is allowed. This is done by - * calling the checkRead() method of the SecurityManager - * (if one exists) with the name of this file. An exception is thrown - * if reading is not allowed. If the file does not exist, an exception - * is also thrown. - * - * @param name The name of the file this stream should read from - * - * @exception SecurityException If read access to the file is not allowed - * @exception FileNotFoundException If the file does not exist. - */ -public -FileInputStream(String name) throws SecurityException, FileNotFoundException -{ - this(new File(name)); -} - -/*************************************************************************/ - -/** - * This method initializes a FileInputStream to read from the - * specified File object. A security check is first made to determine - * whether or not access to this file is allowed. This is done by - * calling the checkRead() method of the SecurityManager - * (if one exists) with the name of this file. An exception is thrown - * if reading is not allowed. If the file does not exist, an exception - * is also thrown. - * - * @param file The File object this stream should read from - * - * @exception SecurityException If read access to the file is not allowed - * @exception FileNotFoundException If the file does not exist. - */ -public -FileInputStream(File file) throws SecurityException, FileNotFoundException -{ - // Talk about the lazy man's way out. The File.exists() method does - // a security check so don't repeat it here. - if (!file.exists()) - throw new FileNotFoundException(file.getName()); - - fd = FileDescriptor.open(file.getPath(), FileDescriptor.Read); -} - -/*************************************************************************/ - -/** - * This method initializes a FileInputStream to read from the - * specified FileDescriptor object. A security check is first made to - * determine whether or not access to this file is allowed. This is done by - * calling the checkRead() method of the SecurityManager - * (if one exists) with the specified FileDescriptor An exception is - * thrown if reading is not allowed. - * - * @param fd The FileDescriptor object this stream should read from - * - * @exception SecurityException If read access to the file is not allowed - */ -public -FileInputStream(FileDescriptor fd) throws SecurityException -{ - // Hmmm, no other exception but this one to throw, but if the descriptor - // isn't valid, we surely don't have "permission" to read from it. - if (!fd.valid()) - throw new SecurityException("Invalid FileDescriptor"); - - SecurityManager sm = System.getSecurityManager(); - if (sm != null) - sm.checkRead(fd); - - this.fd = fd; -} - -/*************************************************************************/ - -/* - * Instance Methods - */ - -/** - * This method returns a FileDescriptor object representing the - * underlying native file handle of the file this stream is reading - * from - * - * @return A FileDescriptor for this stream - * - * @exception IOException If an error occurs - */ -public final FileDescriptor -getFD() throws IOException -{ - return fd; -} - -/*************************************************************************/ - -/** - * This method returns the number of bytes that can be read from this - * stream before a read can block. A return of 0 indicates that blocking - * might (or might not) occur on the very next read attempt. - *

- * This method returns the number of unread bytes remaining in the file if - * the descriptor being read from is an actual file. If this method is - * reading from a ''special'' file such a the standard input, this method - * will return the appropriate value for the stream being read. - *

- * Be aware that reads on plain files that do not reside locally might - * possibly block even if this method says they should not. For example, - * a remote server might crash, preventing an NFS mounted file from being - * read. - * - * @return The number of bytes that can be read before blocking could occur - * - * @exception IOException If an error occurs - */ -public int -available() throws IOException -{ - int retval = (int)(fd.getLength() - fd.getFilePointer()); - - if (retval <= 0) - return(0); - - return(retval); -} - -/*************************************************************************/ - -/** - * This method skips the specified number of bytes in the stream. It - * returns the actual number of bytes skipped, which may be less than the - * requested amount. - *

- * This method reads and discards bytes into a 256 byte array until the - * specified number of bytes were skipped or until either the end of stream - * is reached or a read attempt returns a short count. Subclasses can - * override this metho to provide a more efficient implementation where - * one exists. - * - * @param num_bytes The requested number of bytes to skip - * - * @return The actual number of bytes skipped. - * - * @exception IOException If an error occurs - */ -public long -skip(long num_bytes) throws IOException -{ - if (num_bytes <= 0) - return(0); - - if (num_bytes > available()) - num_bytes = available(); - - long bytes_skipped = fd.skip(num_bytes); - - return(bytes_skipped); -} - -/*************************************************************************/ - -/** - * This method reads an unsigned byte from the input stream and returns it - * as an int in the range of 0-255. This method also will return -1 if - * the end of the stream has been reached. - *

- * This method will block until the byte can be read. - * - * @return The byte read or -1 if end of stream - * - * @exception IOException If an error occurs - */ -public int -read() throws IOException -{ - byte[] buf = new byte[1]; - - int bytes_read = fd.read(buf, 0, buf.length); - if (bytes_read == 0) - return(-1); - if (bytes_read == -1) - return(-1); - - return((buf[0] & 0xFF)); -} - -/*************************************************************************/ - -/** - * This method reads bytes from a stream and stores them into a caller - * supplied buffer. This method attempts to completely fill the buffer, - * but can return before doing so. The actual number of bytes read is - * returned as an int. A -1 is returned to indicate the end of the stream. - *

- * This method will block until some data can be read. - *

- * This method operates by calling an overloaded read method like so: - * read(buf, 0, buf.length) - * - * @param buf The buffer into which the bytes read will be stored. - * - * @return The number of bytes read or -1 if end of stream. - * - * @exception IOException If an error occurs. - */ -public int -read(byte[] buf) throws IOException -{ - return(read(buf, 0, buf.length)); -} - -/*************************************************************************/ - -/** - * This method read bytes from a stream and stores them into a caller - * supplied buffer. It starts storing the data at index offset into - * the buffer and attempts to read len bytes. This method can - * return before reading the number of bytes requested. The actual number - * of bytes read is returned as an int. A -1 is returned to indicate the - * end of the stream. - *

- * This method will block until some data can be read. - * - * @param buf The array into which the bytes read should be stored - * @param offset The offset into the array to start storing bytes - * @param len The requested number of bytes to read - * - * @return The actual number of bytes read, or -1 if end of stream. - * - * @exception IOException If an error occurs. - */ -public int -read(byte[] buf, int offset, int len) throws IOException -{ - if (len == 0) - return(0); - - int bytes_read = fd.read(buf, offset, len); - if (bytes_read == 0) - return(-1); - if (bytes_read == -1) - return(-1); - - return(bytes_read); -} - -/*************************************************************************/ - -/** - * This method closes the stream. Any futher attempts to read from the - * stream will likely generate an IOException since the underlying file - * will be closed. - * - * @exception IOException If an error occurs. - */ -public void -close() throws IOException -{ - fd.close(); -} - -/*************************************************************************/ - -/** - * This method ensures that the underlying file is closed when this object - * is garbage collected. Since there is a system dependent limit on how - * many files a single process can have open, it is a good idea to close - * streams when they are no longer needed rather than waiting for garbage - * collectio to automatically close them. - * - * @exception IOException If an error occurs - */ -protected void -finalize() throws IOException -{ - if(fd != null) - { - close(); - } -} - - -/*************************************************************************/ - -/** - * This method creates a java.nio.channels.FileChannel. - * Nio does not allow one to create a file channel directly. - * A file channel must be created by first creating an instance of - * Input/Output/RandomAccessFile and invoking the getChannel() method on it. - */ - -private FileChannel ch; /* cached associated file-channel */ - -public FileChannel -getChannel() -{ - synchronized (this) - { -// if (ch == null) -// ch = new gnu.java.nio.FileChannelImpl(native_fd, -// this); - } - return ch; -} - - -} // class FileInputStream - diff --git a/classpath/java/io/FileOutputStream.java b/classpath/java/io/FileOutputStream.java deleted file mode 100644 index 9776dea1..00000000 --- a/classpath/java/io/FileOutputStream.java +++ /dev/null @@ -1,339 +0,0 @@ -/* FileOutputStream.java -- Writes to a file on disk. - Copyright (C) 1998, 2001 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package java.io; - -import gnu.classpath.Configuration; -import java.nio.channels.FileChannel; -import gnu.java.nio.FileChannelImpl; - -/** - * This classes allows a stream of data to be written to a disk file or - * any open FileDescriptor. - * - * @version 0.0 - * - * @author Aaron M. Renn (arenn@urbanophile.com) - */ -public class FileOutputStream extends OutputStream -{ - -/*************************************************************************/ - -/* - * Class Variables and Initializers - */ - - static - { - if (Configuration.INIT_LOAD_LIBRARY) - { - System.loadLibrary ("javaio"); - } - } - -/*************************************************************************/ - -/* - * Instance Variables - */ - -/** - * This is the native file handle - */ -private FileDescriptor fd; - -/*************************************************************************/ - -/* - * Constructors - */ - -/** - * This method initializes a FileOutputStream object to write - * to the named file. The file is created if it does not exist, and - * the bytes written are written starting at the beginning of the file. - *

- * Before opening a file, a security check is performed by calling the - * checkWrite method of the SecurityManager (if - * one exists) with the name of the file to be opened. An exception is - * thrown if writing is not allowed. - * - * @param name The name of the file this stream should write to - * - * @exception SecurityException If write access to the file is not allowed - * @exception IOException If a non-security error occurs - */ -public -FileOutputStream(String name) throws SecurityException, IOException -{ - this(name, false); -} - -/*************************************************************************/ - -/** - * This method initializes a FileOutputStream object to write - * to the specified File object. The file is created if it - * does not exist, and the bytes written are written starting at the - * beginning of the file. - *

- * Before opening a file, a security check is performed by calling the - * checkWrite method of the SecurityManager (if - * one exists) with the name of the file to be opened. An exception is - * thrown if writing is not allowed. - * - * @param file The File object this stream should write to - * - * @exception SecurityException If write access to the file is not allowed - * @exception IOException If a non-security error occurs - */ -public -FileOutputStream(File file) throws SecurityException, IOException -{ - this(file.getPath(), false); -} - -/*************************************************************************/ - -/** - * This method initializes a FileOutputStream object to write - * to the named file. The file is created if it does not exist, and - * the bytes written are written starting at the beginning of the file if - * the append argument is false or at the end - * of the file if the append argument is true. - *

- * Before opening a file, a security check is performed by calling the - * checkWrite method of the SecurityManager (if - * one exists) with the name of the file to be opened. An exception is - * thrown if writing is not allowed. - * - * @param name The name of the file this stream should write to - * @param append true to append bytes to the end of the file, or false to write bytes to the beginning - * - * @exception SecurityException If write access to the file is not allowed - * @exception IOException If a non-security error occurs - */ -public -FileOutputStream(String name, boolean append) throws SecurityException, - IOException -{ - SecurityManager sm = System.getSecurityManager(); - if (sm != null) - { -// try -// { - sm.checkWrite(name); -// } -// catch(AccessControlException e) -// { -// throw new SecurityException(e.getMessage()); -// } - } - - fd = FileDescriptor.open((new File(name)).getAbsolutePath(), append ? FileDescriptor.Append : FileDescriptor.Write); -} - -/*************************************************************************/ - -/** - * This method initializes a FileOutputStream object to write - * to the file represented by the specified FileDescriptor - * object. This method does not create any underlying disk file or - * reposition the file pointer of the given descriptor. It assumes that - * this descriptor is ready for writing as is. - *

- * Before opening a file, a security check is performed by calling the - * checkWrite method of the SecurityManager (if - * one exists) with the specified FileDescriptor as an argument. - * An exception is thrown if writing is not allowed. - * - * @param file The FileDescriptor this stream should write to - * - * @exception SecurityException If write access to the file is not allowed - */ -public -FileOutputStream(FileDescriptor fd) throws SecurityException -{ - // Hmm, no other exception but this one to throw, but if the descriptor - // isn't valid, we surely don't have "permission" to write to it. - if (!fd.valid()) - throw new SecurityException("Invalid FileDescriptor"); - - SecurityManager sm = System.getSecurityManager(); - if (sm != null) - { -// try -// { - // sm.checkWrite(fd); -// } -// catch(AccessControlException e) -// { -// throw new SecurityException(e.getMessage()); -// } - } - - this.fd = fd; -} - -/*************************************************************************/ - -/** - * This method returns a FileDescriptor object representing - * the file that is currently being written to - * - * @return A FileDescriptor object for this stream - * - * @exception IOException If an error occurs - */ -public final FileDescriptor -getFD() throws IOException -{ - return fd; -} - -/*************************************************************************/ - -/** - * This method writes a single byte of data to the file. - * - * @param b The byte of data to write, passed as an int - * - * @exception IOException If an error occurs - */ -public void -write(int b) throws IOException -{ - byte[] buf = new byte[1]; - - buf[0] = (byte)(b & 0xFF); - fd.write(buf, 0, buf.length); -} - -/*************************************************************************/ - -/** - * This method writes all the bytes in the specified array to the - * file. - * - * @param buf The array of bytes to write to the file - * - * @exception IOException If an error occurs - */ -public void -write(byte[] buf) throws IOException -{ - fd.write(buf, 0, buf.length); -} - -/*************************************************************************/ - -/** - * This method writes len bytes from the byte array - * buf to the file starting at index offset. - * - * @param buf The array of bytes to write to the file - * @param offset The offset into the array to start writing bytes from - * @param len The number of bytes to write to the file - * - * @exception IOException If an error occurs - */ -public void -write(byte[] buf, int offset, int len) throws IOException -{ - fd.write(buf, offset, len); -} - -/*************************************************************************/ - -/** - * This method closes the underlying file. Any further attempts to - * write to this stream will likely generate an exception since the - * file is closed. - * - * @exception IOException If an error occurs - */ -public void -close() throws IOException -{ - fd.close(); -} - -/*************************************************************************/ - -/** - * This method closes the stream when this object is being garbage - * collected. - * - * @exception IOException If an error occurs (ignored by the Java runtime) - */ -protected void -finalize() throws IOException -{ - if(fd != null) - { - close(); - } -} - -/*************************************************************************/ - -/** - * This method creates a java.nio.channels.FileChannel. - * Nio does not allow one to create a file channel directly. - * A file channel must be created by first creating an instance of - * Input/Output/RandomAccessFile and invoking the getChannel() method on it. - */ - -private FileChannel ch; /* cached associated file-channel */ - -public FileChannel -getChannel() -{ - synchronized (this) - { -// if (ch == null) -// ch = new gnu.java.nio.FileChannelImpl(native_fd, -// this); - } - return ch; -} - - -} // class FileOutputStream - diff --git a/classpath/java/io/RandomAccessFile.java b/classpath/java/io/RandomAccessFile.java deleted file mode 100644 index 2e183954..00000000 --- a/classpath/java/io/RandomAccessFile.java +++ /dev/null @@ -1,1197 +0,0 @@ -/* RandomAccessFile.java -- Class supporting random file I/O - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package java.io; - -import gnu.classpath.Configuration; -import java.nio.channels.FileChannel; -import gnu.java.nio.FileChannelImpl; - -/** - * This class allows reading and writing of files at random locations. - * Most Java I/O classes are either pure sequential input or output. This - * class fulfills the need to be able to read the bytes of a file in an - * arbitrary order. In addition, this class implements the - * DataInput and DataOutput interfaces to allow - * the reading and writing of Java primitives. - * - * @version 0.0 - * - * @author Aaron M. Renn (arenn@urbanophile.com) - */ -public class RandomAccessFile implements DataOutput, DataInput -{ - - static - { - if (Configuration.INIT_LOAD_LIBRARY) - { - System.loadLibrary ("javaio"); - } - } - -/*************************************************************************/ - -/* - * Instance Variables - */ - -/** - * The native file descriptor for this file - */ -private FileDescriptor fd; - -/** - * Whether or not this file is open in read only mode - */ -private boolean read_only; - -/*************************************************************************/ - -/* - * Constructors - */ - -/** - * This method initializes a new instance of RandomAccessFile - * to read from the specified file name with the specified access mode. - * The access mode is either "r" for read only access or "rw" for read - * write access. - *

- * Note that a SecurityManager check is made prior to - * opening the file to determine whether or not this file is allowed to - * be read or written. - * - * @param name The name of the file to read and/or write - * @param mode "r" for read only or "rw" for read-write access to the file - * - * @exception IllegalArgumentException If mode has an illegal value - * @exception SecurityException If the requested access to the file is not allowed - * @exception IOException If any other error occurs - */ -public -RandomAccessFile(String name, String mode) throws IllegalArgumentException, - SecurityException, - IOException -{ - this(new File(name), mode); -} - -/*************************************************************************/ - -/** - * This method initializes a new instance of RandomAccessFile - * to read from the specified File object with the specified - * access mode. The access mode is either "r" for read only access or "rw" - * for read-write access. - *

- * Note that a SecurityManager check is made prior to - * opening the file to determine whether or not this file is allowed to - * be read or written. - * - * @param file The File object to read and/or write. - * @param mode "r" for read only or "rw" for read-write access to the file - * - * @exception IllegalArgumentException If mode has an illegal value - * @exception SecurityException If the requested access to the file is not allowed - * @exception IOException If any other error occurs - */ -public -RandomAccessFile(File file, String mode) throws IllegalArgumentException, - SecurityException, - IOException -{ - // Check the mode - if (!mode.equals("r") && !mode.equals("rw")) - throw new IllegalArgumentException("Bad mode value: " + mode); - - // The obligatory SecurityManager stuff - SecurityManager sm = System.getSecurityManager(); - if (sm != null) - { - if (mode.equals("r")) - sm.checkRead(file.getPath()); - else if (mode.equals("rw")) - sm.checkWrite(file.getPath()); - } - - if (mode.equals("r")) - read_only = true; - - fd = FileDescriptor.open(file.getPath(), read_only ? FileDescriptor.Read : FileDescriptor.ReadWrite); -} - -/*************************************************************************/ - -/* - * Instance Methods - */ - -/** - * This method closes the file and frees up all file related system - * resources. Since most operating systems put a limit on how many files - * may be opened at any given time, it is a good idea to close all files - * when no longer needed to avoid hitting this limit - */ -public void -close() throws IOException -{ - fd.close(); -} - -/*************************************************************************/ - -/** - * This method returns a FileDescriptor object that - * represents the native file handle for this file. - * - * @return The FileDescriptor object for this file - * - * @exception IOException If an error occurs - */ -public final FileDescriptor -getFD() throws IOException -{ - return fd; -} - -/*************************************************************************/ - -/** - * This method returns the current offset in the file at which the next - * read or write will occur - * - * @return The current file position - * - * @exception IOException If an error occurs - */ -public long -getFilePointer() throws IOException -{ - return fd.getFilePointer(); -} - -/*************************************************************************/ - -/** - * This method returns the length of the file in bytes - * - * @return The length of the file - * - * @exception IOException If an error occurs - */ -public long -length() throws IOException -{ - return fd.getLength(); -} - -/*************************************************************************/ - -/** - * This method sets the current file position to the specified offset - * from the beginning of the file. Note that some operating systems will - * allow the file pointer to be set past the current end of the file. - * - * @param pos The offset from the beginning of the file at which to set the file pointer - * - * @exception IOException If an error occurs - */ -public void -seek(long pos) throws IOException -{ - fd.seek(pos); -} - -/*************************************************************************/ - -/** - * This method sets the length of the file to the specified length. If - * the currently length of the file is longer than the specified length, - * then the file is truncated to the specified length. If the current - * length of the file is shorter than the specified length, the file - * is extended with bytes of an undefined value. - *

- * The file must be open for write access for this operation to succeed. - * - * @param newlen The new length of the file - * - * @exception IOException If an error occurs - */ -public void -setLength(long newlen) throws IOException -{ - if (read_only) - throw new IOException("File is open read only"); - - fd.setLength(newlen); -} - -/*************************************************************************/ - -/** - * This method reads a single byte of data from the file and returns it - * as an integer. - * - * @return The byte read as an int, or -1 if the end of the file was reached. - * - * @exception IOException If an error occurs - */ -public int -read() throws IOException -{ - byte[] buf = new byte[1]; - - int rc = fd.read(buf, 0, buf.length); - if (rc == 0) - return(-1); - - return(buf[0] & 0xFF); -} - -/*************************************************************************/ - -/** - * This method reads bytes from the file into the specified array. The - * bytes are stored starting at the beginning of the array and up to - * buf.length bytes can be read. - * - * @param buf The buffer to read bytes from the file into - * - * @return The actual number of bytes read or -1 if end of file - * - * @exception IOException If an error occurs - */ -public int -read(byte[] buf) throws IOException -{ - int rc = fd.read(buf, 0, buf.length); - if (rc == 0) - return(-1); - else - return(rc); -} - -/*************************************************************************/ - -/** - * This methods reads up to len bytes from the file into the s - * pecified array starting at position offset into the array. - * - * @param buf The array to read the bytes into - * @param offset The index into the array to start storing bytes - * @param len The requested number of bytes to read - * - * @param len The actual number of bytes read, or -1 if end of file - * - * @exception IOException If an error occurs - */ -public int -read(byte[] buf, int offset, int len) throws IOException -{ - int rc = fd.read(buf, offset, len); - if (rc == 0) - return(-1); - else - return(rc); -} - -/*************************************************************************/ - -/** - * This method reads a Java boolean value from an input stream. It does - * so by reading a single byte of data. If that byte is zero, then the - * value returned is false If the byte is non-zero, then - * the value returned is true - *

- * This method can read a boolean written by an object implementing the - * writeBoolean() method in the DataOutput interface. - * - * @return The boolean value read - * - * @exception EOFException If end of file is reached before reading the boolean - * @exception IOException If any other error occurs - */ -public final boolean -readBoolean() throws EOFException, IOException -{ - int byte_read = read(); - - if (byte_read == -1) - throw new EOFException("Unexpected end of stream"); - - return(DataInputStream.convertToBoolean(byte_read)); -} - -/*************************************************************************/ - -/** - * This method reads a Java byte value from an input stream. The value - * is in the range of -128 to 127. - *

- * This method can read a byte written by an object implementing the - * writeByte() method in the DataOutput interface. - * - * @return The byte value read - * - * @exception EOFException If end of file is reached before reading the byte - * @exception IOException If any other error occurs - * - * @see DataOutput - */ -public final byte -readByte() throws EOFException, IOException -{ - int byte_read = read(); - - if (byte_read == -1) - throw new EOFException("Unexpected end of stream"); - - return(DataInputStream.convertToByte(byte_read)); -} - -/*************************************************************************/ - -/** - * This method reads 8 unsigned bits into a Java int value from the - * stream. The value returned is in the range of 0 to 255. - *

- * This method can read an unsigned byte written by an object implementing the - * writeUnsignedByte() method in the DataOutput interface. - * - * @return The unsigned bytes value read as a Java int - * - * @exception EOFException If end of file is reached before reading the value - * @exception IOException If any other error occurs - * - * @see DataOutput - */ -public final int -readUnsignedByte() throws EOFException, IOException -{ - int byte_read = read(); - - if (byte_read == -1) - throw new EOFException("Unexpected end of stream"); - - return(DataInputStream.convertToUnsignedByte(byte_read)); -} - -/*************************************************************************/ - -/** - * This method reads a Java char value from an input stream. - * It operates by reading two bytes from the stream and converting them to - * a single 16-bit Java char The two bytes are stored most - * significant byte first (i.e., "big endian") regardless of the native - * host byte ordering. - *

- * As an example, if byte1 and code{byte2 represent the first - * and second byte read from the stream respectively, they will be - * transformed to a char in the following manner: - *

- * (char)(((byte1 & 0xFF) << 8) | (byte2 & 0xFF) - *

- * This method can read a char written by an object implementing the - * writeChar() method in the DataOutput interface. - * - * @return The char value read - * - * @exception EOFException If end of file is reached before reading the char - * @exception IOException If any other error occurs - * - * @see DataOutput - */ -public final char -readChar() throws EOFException, IOException -{ - byte[] buf = new byte[2]; - - readFully(buf); - - return(DataInputStream.convertToChar(buf)); -} - -/*************************************************************************/ - -/** - * This method reads a signed 16-bit value into a Java in from the stream. - * It operates by reading two bytes from the stream and converting them to - * a single 16-bit Java short The two bytes are stored most - * significant byte first (i.e., "big endian") regardless of the native - * host byte ordering. - *

- * As an example, if byte1 and code{byte2 represent the first - * and second byte read from the stream respectively, they will be - * transformed to a short in the following manner: - *

- * (short)(((byte1 & 0xFF) << 8) | (byte2 & 0xFF) - *

- * The value returned is in the range of -32768 to 32767. - *

- * This method can read a short written by an object implementing the - * writeShort() method in the DataOutput interface. - * - * @return The short value read - * - * @exception EOFException If end of file is reached before reading the value - * @exception IOException If any other error occurs - * - * @see DataOutput - */ -public final short -readShort() throws EOFException, IOException -{ - byte[] buf = new byte[2]; - - readFully(buf); - - return(DataInputStream.convertToShort(buf)); -} - -/*************************************************************************/ - -/** - * This method reads 16 unsigned bits into a Java int value from the stream. - * It operates by reading two bytes from the stream and converting them to - * a single Java int The two bytes are stored most - * significant byte first (i.e., "big endian") regardless of the native - * host byte ordering. - *

- * As an example, if byte1 and code{byte2 represent the first - * and second byte read from the stream respectively, they will be - * transformed to an int in the following manner: - *

- * (int)(((byte1 & 0xFF) << 8) + (byte2 & 0xFF)) - *

- * The value returned is in the range of 0 to 65535. - *

- * This method can read an unsigned short written by an object implementing - * the writeUnsignedShort() method in the DataOutput interface. - * - * @return The unsigned short value read as a Java int - * - * @exception EOFException If end of file is reached before reading the value - * @exception IOException If any other error occurs - */ -public final int -readUnsignedShort() throws EOFException, IOException -{ - byte[] buf = new byte[2]; - - readFully(buf); - - return(DataInputStream.convertToUnsignedShort(buf)); -} - -/*************************************************************************/ - -/** - * This method reads a Java int value from an input stream - * It operates by reading four bytes from the stream and converting them to - * a single Java int The bytes are stored most - * significant byte first (i.e., "big endian") regardless of the native - * host byte ordering. - *

- * As an example, if byte1 through byte4 represent the first - * four bytes read from the stream, they will be - * transformed to an int in the following manner: - *

- * (int)(((byte1 & 0xFF) << 24) + ((byte2 & 0xFF) << 16) + - * ((byte3 & 0xFF) << 8) + (byte4 & 0xFF))) - *

- * The value returned is in the range of 0 to 65535. - *

- * This method can read an int written by an object implementing the - * writeInt() method in the DataOutput interface. - * - * @return The int value read - * - * @exception EOFException If end of file is reached before reading the int - * @exception IOException If any other error occurs - * - * @see DataOutput - */ -public final int -readInt() throws EOFException, IOException -{ - byte[] buf = new byte[4]; - - readFully(buf); - - return(DataInputStream.convertToInt(buf)); -} - -/*************************************************************************/ - -/** - * This method reads a Java long value from an input stream - * It operates by reading eight bytes from the stream and converting them to - * a single Java long The bytes are stored most - * significant byte first (i.e., "big endian") regardless of the native - * host byte ordering. - *

- * As an example, if byte1 through byte8 represent the first - * eight bytes read from the stream, they will be - * transformed to an long in the following manner: - *

- * (long)((((long)byte1 & 0xFF) << 56) + (((long)byte2 & 0xFF) << 48) + - * (((long)byte3 & 0xFF) << 40) + (((long)byte4 & 0xFF) << 32) + - * (((long)byte5 & 0xFF) << 24) + (((long)byte6 & 0xFF) << 16) + - * (((long)byte7 & 0xFF) << 8) + ((long)byte9 & 0xFF))) - *

- * The value returned is in the range of 0 to 65535. - *

- * This method can read an long written by an object implementing the - * writeLong() method in the DataOutput interface. - * - * @return The long value read - * - * @exception EOFException If end of file is reached before reading the long - * @exception IOException If any other error occurs - * - * @see DataOutput - */ -public final long -readLong() throws EOFException, IOException -{ - byte[] buf = new byte[8]; - - readFully(buf); - - return(DataInputStream.convertToLong(buf)); -} - -/*************************************************************************/ - -/** - * This method reads a Java float value from an input stream. It operates - * by first reading an int value from the stream by calling the - * readInt() method in this interface, then converts that int - * to a float using the intBitsToFloat method in - * the class java.lang.Float - *

- * This method can read a float written by an object implementing the - * writeFloat() method in the DataOutput interface. - * - * @return The float value read - * - * @exception EOFException If end of file is reached before reading the float - * @exception IOException If any other error occurs - * - * @see java.lang.Float - * @see DataOutput - */ -public final float -readFloat() throws EOFException, IOException -{ - int val = readInt(); - - return(Float.intBitsToFloat(val)); -} - -/*************************************************************************/ - -/** - * This method reads a Java double value from an input stream. It operates - * by first reading a logn value from the stream by calling the - * readLong() method in this interface, then converts that long - * to a double using the longBitsToDouble method in - * the class java.lang.Double - *

- * This method can read a double written by an object implementing the - * writeDouble() method in the DataOutput interface. - * - * @return The double value read - * - * @exception EOFException If end of file is reached before reading the double - * @exception IOException If any other error occurs - * - * @see java.lang.Double - * @see DataOutput - */ -public final double -readDouble() throws EOFException, IOException -{ - long val = readLong(); - - return(Double.longBitsToDouble(val)); -} - -/*************************************************************************/ - -/** - * This method reads the next line of text data from an input stream. - * It operates by reading bytes and converting those bytes to char - * values by treating the byte read as the low eight bits of the char - * and using 0 as the high eight bits. Because of this, it does - * not support the full 16-bit Unicode character set. - *

- * The reading of bytes ends when either the end of file or a line terminator - * is encountered. The bytes read are then returned as a String - * A line terminator is a byte sequence consisting of either - * \r \n or \r\n These termination charaters are - * discarded and are not returned as part of the string. - *

- * This method can read data that was written by an object implementing the - * writeLine() method in DataOutput - * - * @return The line read as a String - * - * @exception IOException If an error occurs - * - * @see DataOutput - * - * @deprecated - */ -public final String -readLine() throws IOException -{ - StringBuffer sb = new StringBuffer(""); - - for (;;) - { - int byte_read = read(); - - if (byte_read == -1) - return(sb.toString()); - - char c = (char)byte_read; - - if (c == '\r') - { - byte_read = read(); - if (((char)byte_read) != '\n') - seek(getFilePointer() - 1); - - return(sb.toString()); - } - - if (c == '\n') - return(sb.toString()); - - sb.append(c); - } -} - -/*************************************************************************/ - -/** - * This method reads a String from an input stream that is encoded in - * a modified UTF-8 format. This format has a leading two byte sequence - * that contains the remaining number of bytes to read. This two byte - * sequence is read using the readUnsignedShort() method of this - * interface. - *

- * After the number of remaining bytes have been determined, these bytes - * are read an transformed into char values. These char values - * are encoded in the stream using either a one, two, or three byte format. - * The particular format in use can be determined by examining the first - * byte read. - *

- * If the first byte has a high order bit of 0 then - * that character consists on only one byte. This character value consists - * of seven bits that are at positions 0 through 6 of the byte. As an - * example, if byte1 is the byte read from the stream, it would - * be converted to a char like so: - *

- * (char)byte1 - *

- * If the first byte has 110 as its high order bits, then the - * character consists of two bytes. The bits that make up the character - * value are in positions 0 through 4 of the first byte and bit positions - * 0 through 5 of the second byte. (The second byte should have - * 10 as its high order bits). These values are in most significant - * byte first (i.e., "big endian") order. - *

- * As an example, if byte1 and byte2 are the first two bytes - * read respectively, and the high order bits of them match the patterns - * which indicate a two byte character encoding, then they would be - * converted to a Java char like so: - *

- * (char)(((byte1 & 0x1F) << 6) | (byte2 & 0x3F)) - *

- * If the first byte has a 1110 as its high order bits, then the - * character consists of three bytes. The bits that make up the character - * value are in positions 0 through 3 of the first byte and bit positions - * 0 through 5 of the other two bytes. (The second and third bytes should - * have 10 as their high order bits). These values are in most - * significant byte first (i.e., "big endian") order. - *

- * As an example, if byte1 byte2 and byte3 are the - * three bytes read, and the high order bits of them match the patterns - * which indicate a three byte character encoding, then they would be - * converted to a Java char like so: - *

- * (char)(((byte1 & 0x0F) << 12) | ((byte2 & 0x3F) << 6) | (byte3 & 0x3F)) - *

- * Note that all characters are encoded in the method that requires the - * fewest number of bytes with the exception of the character with the - * value of \u0000 which is encoded as two bytes. This is a - * modification of the UTF standard used to prevent C language style - * NUL values from appearing in the byte stream. - *

- * This method can read data that was written by an object implementing the - * writeUTF() method in DataOutput - * - * @return The String read - * - * @exception EOFException If end of file is reached before reading the String - * @exception UTFDataFormatException If the data is not in UTF-8 format - * @exception IOException If any other error occurs - * - * @see DataOutput - */ -public final String -readUTF() throws EOFException, UTFDataFormatException, IOException -{ - StringBuffer sb = new StringBuffer(""); - - int num_bytes = readUnsignedShort(); - byte[] buf = new byte[num_bytes]; - readFully(buf); - - return(DataInputStream.convertFromUTF(buf)); -} - -/*************************************************************************/ - -/** - * This method reads raw bytes into the passed array until the array is - * full. Note that this method blocks until the data is available and - * throws an exception if there is not enough data left in the stream to - * fill the buffer - * - * @param buf The buffer into which to read the data - * - * @exception EOFException If end of file is reached before filling the buffer - * @exception IOException If any other error occurs - */ -public final void -readFully(byte[] buf) throws EOFException, IOException -{ - readFully(buf, 0, buf.length); -} - -/*************************************************************************/ - -/** - * This method reads raw bytes into the passed array buf starting - * offset bytes into the buffer. The number of bytes read will be - * exactly len Note that this method blocks until the data is - * available and * throws an exception if there is not enough data left in - * the stream to read len bytes. - * - * @param buf The buffer into which to read the data - * @param offset The offset into the buffer to start storing data - * @param len The number of bytes to read into the buffer - * - * @exception EOFException If end of file is reached before filling the buffer - * @exception IOException If any other error occurs - */ -public final void -readFully(byte[] buf, int offset, int len) throws EOFException, IOException -{ - int total_read = 0; - - while (total_read < len) - { - int bytes_read = read(buf, offset + total_read, len - total_read); - if (bytes_read == -1) - throw new EOFException("Unexpected end of stream"); - - total_read += bytes_read; - } -} - -/*************************************************************************/ - -/** - * This method attempts to skip and discard the specified number of bytes - * in the input stream. It may actually skip fewer bytes than requested. - * The actual number of bytes skipped is returned. This method will not - * skip any bytes if passed a negative number of bytes to skip. - * - * @param num_bytes The requested number of bytes to skip. - * - * @return The number of bytes actually skipped. - * - * @exception IOException If an error occurs. - */ -public int -skipBytes(int n) throws EOFException, IOException -{ - if (n <= 0) - return(0); - - long total_skipped = fd.skip(n); - - return((int)n); -} - -/*************************************************************************/ - -/** - * This method writes a single byte of data to the file. The file must - * be open for read-write in order for this operation to succeed. - * - * @param The byte of data to write, passed as an int. - * - * @exception IOException If an error occurs - */ -public void -write(int b) throws IOException -{ - if (read_only) - throw new IOException("File is open read only"); - - byte[] buf = new byte[1]; - buf[0] = (byte)b; - - fd.write(buf, 0, buf.length); -} - -/*************************************************************************/ - -/** - * This method writes all the bytes in the specified array to the file. - * The file must be open read-write in order for this operation to succeed. - * - * @param buf The array of bytes to write to the file - */ -public void -write(byte[] buf) throws IOException -{ - if (read_only) - throw new IOException("File is open read only"); - - fd.write(buf, 0, buf.length); -} - -/*************************************************************************/ - -/** - * This method writes len bytes to the file from the specified - * array starting at index offset into the array. - * - * @param buf The array of bytes to write to the file - * @param offset The index into the array to start writing file - * @param len The number of bytes to write - * - * @exception IOException If an error occurs - */ -public void -write(byte[] buf, int offset, int len) throws IOException -{ - if (read_only) - throw new IOException("File is open read only"); - - fd.write(buf, offset, len); -} - -/*************************************************************************/ - -/** - * This method writes a Java boolean to the underlying output - * stream. For a value of true, 1 is written to the stream. - * For a value of false, 0 is written. - * - * @param b The boolean value to write to the stream - * - * @exception IOException If an error occurs - */ -public final void -writeBoolean(boolean b) throws IOException -{ - int bool = DataOutputStream.convertFromBoolean(b); - write(bool); -} - -/*************************************************************************/ - -/** - * This method writes a Java byte value to the underlying - * output stream. - * - * @param b The byte to write to the stream, passed as an int. - * - * @exception IOException If an error occurs - */ -public final void -writeByte(int b) throws IOException -{ - write(b); -} - -/*************************************************************************/ - -/** - * This method writes all the bytes in a String out to the - * stream. One byte is written for each character in the String. - * The high eight bits of each character are discarded. - * - * @param s The String to write to the stream - * - * @exception IOException If an error occurs - */ -public final void -writeBytes(String s) throws IOException -{ - if (s.length() == 0) - return; - - byte[] buf = new byte[s.length()]; - - for (int i = 0; i < s.length(); i++) - buf[i] = (byte)(s.charAt(i) & 0xFF); - - write(buf); -} - -/*************************************************************************/ - -/** - * This method writes a single char value to the stream, - * high byte first. - * - * @param c The char value to write, passed as an int. - * - * @exception IOException If an error occurs - */ -public final void -writeChar(int c) throws IOException -{ - write(DataOutputStream.convertFromChar(c)); -} - -/*************************************************************************/ - -/** - * This method writes all the characters in a String to the - * stream. There will be two bytes for each character value. The high - * byte of the character will be written first. - * - * @param s The String to write to the stream. - * - * @exception IOException If an error occurs - */ -public final void -writeChars(String s) throws IOException -{ - if (s.length() == 0) - return; - - byte[] buf = DataOutputStream.getConvertedStringChars(s); - write(buf); -} - -/*************************************************************************/ - -/** - * This method writes a Java short to the stream, high byte - * first. This method requires two bytes to encode the value. - * - * @param s The short value to write to the stream, passed as an int. - * - * @exception IOException If an error occurs - */ -public final void -writeShort(int s) throws IOException -{ - write(DataOutputStream.convertFromShort(s)); -} - -/*************************************************************************/ - -/** - * This method writes a Java int to the stream, high bytes - * first. This method requires four bytes to encode the value. - * - * @param i The int value to write to the stream. - * - * @exception IOException If an error occurs - */ -public final void -writeInt(int i) throws IOException -{ - write(DataOutputStream.convertFromInt(i)); -} - -/*************************************************************************/ - -/** - * This method writes a Java long to the stream, high bytes - * first. This method requires eight bytes to encode the value. - * - * @param l The long value to write to the stream. - * - * @exception IOException If an error occurs - */ -public final void -writeLong(long l) throws IOException -{ - write(DataOutputStream.convertFromLong(l)); -} - -/*************************************************************************/ - -/** - * This method writes a Java float value to the stream. This - * value is written by first calling the method Float.floatToIntBits - * to retrieve an int representing the floating point number, - * then writing this int value to the stream exactly the same - * as the writeInt() method does. - * - * @param f The floating point number to write to the stream. - * - * @exception IOException If an error occurs - * - * @see writeInt - */ -public final void -writeFloat(float f) throws IOException -{ - int i = Float.floatToIntBits(f); - writeInt(i); -} - -/*************************************************************************/ - -/** - * This method writes a Java double value to the stream. This - * value is written by first calling the method Double.doubleToLongBits - * to retrieve an long representing the floating point number, - * then writing this long value to the stream exactly the same - * as the writeLong() method does. - * - * @param d The double precision floating point number to write to the stream. - * - * @exception IOException If an error occurs - * - * @see writeLong - */ -public final void -writeDouble(double d) throws IOException -{ - long l = Double.doubleToLongBits(d); - writeLong(l); -} - -/*************************************************************************/ - -/** - * This method writes a Java String to the stream in a modified - * UTF-8 format. First, two bytes are written to the stream indicating the - * number of bytes to follow. Note that this is the number of bytes in the - * encoded String not the String length. Next - * come the encoded characters. Each character in the String - * is encoded as either one, two or three bytes. For characters in the - * range of \u0001 to \u007F, one byte is used. The character - * value goes into bits 0-7 and bit eight is 0. For characters in the range - * of \u0080 to \u007FF, two bytes are used. Bits - * 6-10 of the character value are encoded bits 0-4 of the first byte, with - * the high bytes having a value of "110". Bits 0-5 of the character value - * are stored in bits 0-5 of the second byte, with the high bits set to - * "10". This type of encoding is also done for the null character - * \u0000. This eliminates any C style NUL character values - * in the output. All remaining characters are stored as three bytes. - * Bits 12-15 of the character value are stored in bits 0-3 of the first - * byte. The high bits of the first bytes are set to "1110". Bits 6-11 - * of the character value are stored in bits 0-5 of the second byte. The - * high bits of the second byte are set to "10". And bits 0-5 of the - * character value are stored in bits 0-5 of byte three, with the high bits - * of that byte set to "10". - * - * @param s The String to write to the output in UTF format - * - * @exception IOException If an error occurs - */ -public final void -writeUTF(String s) throws IOException -{ - byte[] buf = DataOutputStream.convertToUTF(s); - - writeShort(buf.length); - write(buf); -} - -/*************************************************************************/ - -/** - * This method creates a java.nio.channels.FileChannel. - * Nio does not allow one to create a file channel directly. - * A file channel must be created by first creating an instance of - * Input/Output/RandomAccessFile and invoking the getChannel() method on it. - */ - -private FileChannel ch; /* cached associated file-channel */ - -public FileChannel -getChannel() -{ - synchronized (this) - { -// if (ch == null) -// ch = new gnu.java.nio.FileChannelImpl(native_fd, -// this); - } - return ch; -} - -/*************************************************************************/ - -/** - * This method ensures that the underlying file is closed when this object - * is garbage collected. Since there is a system dependent limit on how - * many files a single process can have open, it is a good idea to close - * streams when they are no longer needed rather than waiting for garbage - * collectio to automatically close them. - * - * @exception IOException If an error occurs - */ -protected void finalize() throws IOException -{ - if(fd != null) - { - close(); - } -} - - -} // class RandomAccessFile - diff --git a/classpath/java/lang/StringHelper.java b/classpath/java/lang/StringHelper.java new file mode 100644 index 00000000..d0c0e8f9 --- /dev/null +++ b/classpath/java/lang/StringHelper.java @@ -0,0 +1,364 @@ +/* StringHelper.java -- helper class adapted from java/lang/String.java + Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package java.lang; + +import java.util.Locale; +import java.io.UnsupportedEncodingException; +import java.io.CharConversionException; +import gnu.java.io.EncodingManager; +import gnu.java.lang.CharData; + +public final class StringHelper +{ + private StringHelper() {} + + public static boolean equalsIgnoreCase(String s1, String s2) + { + int len = s1.length(); + if(s2 == null || len != s2.length()) + { + return false; + } + for(int i = 0; i < len; i++) + { + char c1 = s1.charAt(i); + char c2 = s2.charAt(i); + if(c1 != c2 && (Character.toUpperCase(c1) != Character.toUpperCase(c2)) && + (Character.toLowerCase(c1) != Character.toLowerCase(c2))) + { + return false; + } + } + return true; + } + + public static int compareTo(String s1, String s2) + { + int len = Math.min(s1.length(), s2.length()); + for(int i = 0; i < len; i++) + { + int diff = s1.charAt(i) - s2.charAt(i); + if(diff != 0) + { + return diff; + } + } + return s1.length() - s2.length(); + } + + public static int compareToIgnoreCase(String s1, String s2) + { + int len = Math.min(s1.length(), s2.length()); + for(int i = 0; i < len; i++) + { + int result = Character.toLowerCase(Character.toUpperCase(s1.charAt(i))) + - Character.toLowerCase(Character.toUpperCase(s2.charAt(i))); + if (result != 0) + return result; + } + return s1.length() - s2.length(); + } + + public static String toLowerCase(String s) + { + return toLowerCase(s, Locale.getDefault()); + } + + public static String toLowerCase(String s, Locale loc) + { + // First, see if the current string is already lower case. + boolean turkish = "tr".equals(loc.getLanguage()); + int len = s.length(); + for(int i = 0; i < len; i++) + { + char ch = s.charAt(i); + if((turkish && ch == '\u0049') || ch != Character.toLowerCase(ch)) + { + // Now we perform the conversion. Fortunately, there are no multi-character + // lowercase expansions in Unicode 3.0.0. + char[] newStr = (char[])s.toCharArray(); + for(; i < len; i++) + { + ch = newStr[i]; + // Hardcoded special case. + newStr[i] = (turkish && ch == '\u0049') ? '\u0131' : Character.toLowerCase(ch); + } + return new String(newStr); + } + } + return s; + } + + public static String toUpperCase(String s) + { + return toUpperCase(s, Locale.getDefault()); + } + + public static String toUpperCase(String s, Locale loc) + { + // First, see how many characters we have to grow by, as well as if the + // current string is already upper case. + boolean turkish = "tr".equals(loc.getLanguage()); + int expand = 0; + boolean unchanged = true; + int i = s.length(); + int x = i; + while (--i >= 0) + { + char ch = s.charAt(--x); + expand += upperCaseExpansion(ch); + unchanged = (unchanged && expand == 0 + && ! (turkish && ch == '\u0069') + && ch == Character.toUpperCase(ch)); + } + if (unchanged) + return s; + + // Now we perform the conversion. + i = s.length(); + if (expand == 0) + { + char[] newStr = s.toCharArray(); + while (--i >= 0) + { + char ch = s.charAt(x); + // Hardcoded special case. + newStr[x++] = (turkish && ch == '\u0069') ? '\u0130' + : Character.toUpperCase(ch); + } + return new String(newStr); + } + + // Expansion is necessary. + char[] newStr = new char[s.length() + expand]; + int j = 0; + while (--i >= 0) + { + char ch = s.charAt(x++); + // Hardcoded special case. + if (turkish && ch == '\u0069') + { + newStr[j++] = '\u0130'; + continue; + } + expand = upperCaseExpansion(ch); + if (expand > 0) + { + int index = upperCaseIndex(ch); + while (expand-- >= 0) + newStr[j++] = upperExpand[index++]; + } + else + newStr[j++] = Character.toUpperCase(ch); + } + return new String(newStr); + } + + private static int upperCaseExpansion(char ch) + { + return Character.direction[Character.readChar(ch) >> 7] & 3; + } + + private static int upperCaseIndex(char ch) + { + // Simple binary search for the correct character. + int low = 0; + int hi = upperSpecial.length - 2; + int mid = ((low + hi) >> 2) << 1; + char c = upperSpecial[mid]; + while (ch != c) + { + if (ch < c) + hi = mid - 2; + else + low = mid + 2; + mid = ((low + hi) >> 2) << 1; + c = upperSpecial[mid]; + } + return upperSpecial[mid + 1]; + } + + private static final char[] upperExpand = CharData.UPPER_EXPAND.toCharArray(); + private static final char[] upperSpecial = CharData.UPPER_SPECIAL.toCharArray(); + + public static String NewString(byte[] ascii, int hibyte, int offset, int count) + { + if (offset < 0 || count < 0 || offset + count > ascii.length) + throw new StringIndexOutOfBoundsException(); + char[] value = new char[count]; + hibyte <<= 8; + offset += count; + while (--count >= 0) + value[count] = (char) (hibyte | (ascii[--offset] & 0xff)); + return new String(value); + } + + public static String NewString(byte[] ascii, int hibyte) + { + return NewString(ascii, hibyte, 0, ascii.length); + } + + public static String NewString(byte[] data, int offset, int count, String encoding) + throws UnsupportedEncodingException + { + if (offset < 0 || count < 0 || offset + count > data.length) + throw new StringIndexOutOfBoundsException(); + try + { + // XXX Consider using java.nio here. + return new String(EncodingManager.getDecoder(encoding) + .convertToChars(data, offset, count)); + } + catch (CharConversionException cce) + { + throw new Error(cce); + } + } + + public static String NewString(byte[] data, String encoding) + throws UnsupportedEncodingException + { + return NewString(data, 0, data.length, encoding); + } + + public static String NewString(byte[] data, int offset, int count) + { + if (offset < 0 || count < 0 || offset + count > data.length) + throw new StringIndexOutOfBoundsException(); + try + { + // XXX Consider using java.nio here. + return new String(EncodingManager.getDecoder() + .convertToChars(data, offset, count)); + } + catch (CharConversionException cce) + { + throw new Error(cce); + } + } + + public static String NewString(byte[] data) + { + return NewString(data, 0, data.length); + } + + public static String NewString(char[] data, int offset, int count, boolean dont_copy) + { + return new String(data, offset, count); + } + + public static void getBytes(String s, int srcBegin, int srcEnd, byte dst[], int dstBegin) + { + if (srcBegin < 0 || srcBegin > srcEnd || srcEnd > s.length()) + throw new StringIndexOutOfBoundsException(); + int i = srcEnd - srcBegin; + while (--i >= 0) + dst[dstBegin++] = (byte)s.charAt(srcBegin++); + } + + public static byte[] getBytes(String s, String enc) throws UnsupportedEncodingException + { + try + { + // XXX Consider using java.nio here. + return EncodingManager.getEncoder(enc) + .convertToBytes(s.toCharArray()); + } + catch (CharConversionException e) + { + return null; + } + } + + public static byte[] getBytes(String s) + { + try + { + // XXX Consider using java.nio here. + return EncodingManager.getEncoder() + .convertToBytes(s.toCharArray()); + } + catch (CharConversionException e) + { + return null; + } + } + + public static boolean regionMatches(String s, int toffset, String other, int ooffset, int len) + { + return regionMatches(s, false, toffset, other, ooffset, len); + } + + public static boolean regionMatches(String s, boolean ignoreCase, int toffset, + String other, int ooffset, int len) + { + if (toffset < 0 || ooffset < 0 || toffset + len > s.length() + || ooffset + len > other.length()) + return false; + while (--len >= 0) + { + char c1 = s.charAt(toffset++); + char c2 = other.charAt(ooffset++); + // Note that checking c1 != c2 is redundant when ignoreCase is true, + // but it avoids method calls. + if (c1 != c2 + && (! ignoreCase + || (Character.toLowerCase(c1) != Character.toLowerCase(c2) + && (Character.toUpperCase(c1) + != Character.toUpperCase(c2))))) + return false; + } + return true; + } + + public static String trim(String s) + { + int limit = s.length(); + if (limit == 0 || (s.charAt(0) > '\u0020' + && s.charAt(limit - 1) > '\u0020')) + return s; + int begin = 0; + do + if (begin == limit) + return ""; + while (s.charAt(begin++) <= '\u0020'); + int end = limit; + while (s.charAt(--end) <= '\u0020'); + return s.substring(begin - 1, end + 1); + } +} diff --git a/classpath/java/lang/VMClassLoader.java b/classpath/java/lang/VMClassLoader.java index 05d3d9b2..3dafaeb7 100644 --- a/classpath/java/lang/VMClassLoader.java +++ b/classpath/java/lang/VMClassLoader.java @@ -118,12 +118,7 @@ final class VMClassLoader */ static Class loadClass(String name, boolean resolve) throws ClassNotFoundException { - Class c = Class.loadBootstrapClass(name, false); - if(c == null) - { - throw new ClassNotFoundException(name); - } - return c; + return Class.loadBootstrapClass(name, false); } /** diff --git a/classpath/java/lang/reflect/Field.java b/classpath/java/lang/reflect/Field.java index fc603836..62e03765 100644 --- a/classpath/java/lang/reflect/Field.java +++ b/classpath/java/lang/reflect/Field.java @@ -134,19 +134,27 @@ public final class Field extends AccessibleObject implements Member /** * Compare two objects to see if they are semantically equivalent. * Two Fields are semantically equivalent if they have the same declaring - * class, name, and type. Since you can't creat a Field except through - * the VM, this is just the == relation. + * class, name, and type. * * @param o the object to compare to * @return true if they are equal; false if not */ public boolean equals(Object o) { - if(o instanceof Field) - { - return fieldCookie == ((Field)o).fieldCookie; - } - return false; + if(!(o instanceof Field)) + return false; + + Field f = (Field)o; + if(!getName().equals(f.getName())) + return false; + + if(declaringClass != f.declaringClass) + return false; + + if(getType() != f.getType()) + return false; + + return true; } /** diff --git a/classpath/java/lang/reflect/Method.java b/classpath/java/lang/reflect/Method.java index af2be74b..d1585ce9 100644 --- a/classpath/java/lang/reflect/Method.java +++ b/classpath/java/lang/reflect/Method.java @@ -175,27 +175,6 @@ public final class Method extends AccessibleObject implements Member */ public boolean equals(Object o) { - // Implementation note: - // The following is a correct but possibly slow implementation. - // - // This class has a private field 'slot' that could be used by - // the VM implementation to "link" a particular method to a Class. - // In that case equals could be simply implemented as: - // - // if (o instanceof Method) - // { - // Method m = (Method)o; - // return m.declaringClass == this.declaringClass - // && m.slot == this.slot; - // } - // return false; - // - // If a VM uses the Method class as their native/internal representation - // then just using the following would be optimal: - // - // return return this == o; - // - if (!(o instanceof Method)) return false; @@ -206,6 +185,9 @@ public final class Method extends AccessibleObject implements Member if(declaringClass != m.declaringClass) return false; + if(getReturnType() != m.getReturnType()) + return false; + Class[] params1 = getParameterTypes(); Class[] params2 = m.getParameterTypes(); if(params1.length != params2.length) diff --git a/ikvm/starter.cs b/ikvm/starter.cs index f7b5e0d3..5e90d78a 100644 --- a/ikvm/starter.cs +++ b/ikvm/starter.cs @@ -146,15 +146,15 @@ public class Starter { if(args[i][0] == '-') { - if(args[i] == "-help") + if(args[i] == "-help" || args[i] == "-?") { break; } - else if(args[i] == "-save") + else if(args[i] == "-Xsave") { saveAssembly = true; } - else if(args[i] == "-time") + else if(args[i] == "-Xtime") { new Timer(); } @@ -179,6 +179,10 @@ public class Starter { java.lang.System.setProperty("ikvm.boot.class.path", args[i].Substring(16)); } + else if(args[i] == "-Xlogclf") + { + JVM.LogClassLoadFailures = true; + } else { Console.Error.WriteLine("{0}: illegal argument", args[i]); @@ -201,14 +205,15 @@ public class Starter Console.Error.WriteLine(" (to execute a jar file)"); Console.Error.WriteLine(); Console.Error.WriteLine("where options include:"); - Console.Error.WriteLine(" -help display this message"); - Console.Error.WriteLine(" -cp -classpath "); + Console.Error.WriteLine(" -? -help display this message"); + Console.Error.WriteLine(" -cp -classpath ", Path.PathSeparator); Console.Error.WriteLine(" set search path for application classes and resources"); - Console.Error.WriteLine(" -save save the generated assembly (for debugging)"); - Console.Error.WriteLine(" -time time the execution"); Console.Error.WriteLine(" -D= set a system property"); - Console.Error.WriteLine(" -Xbootclasspath:"); + Console.Error.WriteLine(" -Xsave save the generated assembly (for debugging)"); + Console.Error.WriteLine(" -Xtime time the execution"); + Console.Error.WriteLine(" -Xbootclasspath:", Path.PathSeparator); Console.Error.WriteLine(" set search path for bootstrap classes and resources"); + Console.Error.WriteLine(" -Xlogclf log class load failures"); return 1; } try