public void read(Stream f) { // MAES: Byte Buffers actually make it convenient changing byte order on-the-fly. // But RandomAccessFiles (and inputsteams) don't :-S if (!big_endian) { filepos = DoomIO.readUnsignedLEInt(f); size = DoomIO.readUnsignedLEInt(f); } else { filepos = f.readInt(); size = f.readInt(); } // Names used in the reading subsystem should be upper case, // but check for compressed status first name = DoomIO.readNullTerminatedString(f, 8); char[] stuff = name.toCharArray(); // It's a compressed lump if (stuff[0] > 0x7F) { compressed = true; stuff[0] &= 0x7F; } actualname = new String(stuff).ToUpper(); }
public void write(Stream dos) { if (!big_endian) { DoomIO.writeLEInt(dos, (int)filepos); DoomIO.writeLEInt(dos, (int)size); } else { dos.writeInt((int)filepos); dos.writeInt((int)size); } DoomIO.writeString(dos, name, 8); }