Org.Mozilla.Classfile.ClassFileWriter.ClassFileWriter C# (CSharp) Method

ClassFileWriter() static private method

static private ClassFileWriter ( ) : System
return System
		static ClassFileWriter()
		{
			// Used to find blocks of code with no dependencies (aka dead code).
			// Necessary for generating type information for dead code, which is
			// expected by the Sun verifier. It is only necessary to store a single
			// jump source to determine if a block is reachable or not.
			// Figure out which classfile version should be generated. This assumes
			// that the runtime used to compile the JavaScript files is the same as
			// the one used to run them. This is important because there are cases
			// when bytecode is generated at runtime, where it is not easy to pass
			// along what version is necessary. Instead, we grab the version numbers
			// from the bytecode of this class and use that.
			//
			// Based on the version numbers we scrape, we can also determine what
			// bytecode features we need. For example, Java 6 bytecode (classfile
			// version 50) should have stack maps generated.
			Stream @is = null;
			int major = 48;
			int minor = 0;
			try
			{
				@is = typeof(ClassFileWriter).GetResourceAsStream("ClassFileWriter.class");
				if (@is == null)
				{
					@is = ClassLoader.GetSystemResourceAsStream("org/mozilla/classfile/ClassFileWriter.class");
				}
				byte[] header = new byte[8];
				// read loop is required since JDK7 will only provide 2 bytes
				// on the first read() - see bug #630111
				int read = 0;
				while (read < 8)
				{
					int c = @is.Read(header, read, 8 - read);
					if (c < 0)
					{
						throw new IOException();
					}
					read += c;
				}
				minor = (header[4] << 8) | (header[5] & unchecked((int)(0xff)));
				major = (header[6] << 8) | (header[7] & unchecked((int)(0xff)));
			}
			catch (Exception)
			{
			}
			finally
			{
				// Unable to get class file, use default bytecode version
				MinorVersion = minor;
				MajorVersion = major;
				GenerateStackMap = major >= 50;
				if (@is != null)
				{
					try
					{
						@is.Close();
					}
					catch (IOException)
					{
					}
				}
			}
		}

Same methods

ClassFileWriter::ClassFileWriter ( string className, string superClassName, string sourceFileName ) : System