| 11 | } |
| 12 | |
| 13 | pub fn write_class(&mut self, classfile: &Classfile) -> Result<usize, Error> { |
| 14 | self.write_magic_bytes() |
| 15 | .and(self.write_classfile_version(&classfile.version)) |
| 16 | .and(self.write_constant_pool(&classfile.constant_pool)) |
| 17 | .and(self.write_access_flags(&classfile.access_flags)) |
| 18 | .and(self.write_constant_pool_index(&classfile.this_class)) |
| 19 | .and(self.write_constant_pool_index(&classfile.super_class)) |
| 20 | .and(self.write_interfaces(&classfile.interfaces)) |
| 21 | .and(self.write_fields(&classfile.fields, &classfile.constant_pool)) |
| 22 | .and(self.write_methods(&classfile.methods, &classfile.constant_pool)) |
| 23 | .and(self.write_attributes(&classfile.attributes, &classfile.constant_pool)) |
| 24 | } |
| 25 | |
| 26 | pub fn write_magic_bytes(&mut self) -> Result<usize, Error> { |
| 27 | self.write_u32(0xCAFEBABE) |