test_class.declarator: SCRIPT_RESOURCE = "/net/runelite/cache/script/assembler/91.rs2asm"
test_class.modifier: private static final
test_class.original_string: private static final String SCRIPT_RESOURCE = "/net/runelite/cache/script/assembler/91.rs2asm";
test_class.type: String
test_class.var_name: SCRIPT_RESOURCE
test_class.declarator: SCRIPT_RESOURCE_UNICODE = "/net/runelite/cache/script/assembler/Unicode.rs2asm"
test_class.modifier: private static final
test_class.original_string: private static final String SCRIPT_RESOURCE_UNICODE = "/net/runelite/cache/script/assembler/Unicode.rs2asm";
test_class.type: String
test_class.var_name: SCRIPT_RESOURCE_UNICODE
test_class.file: cache/src/test/java/net/runelite/cache/definitions/savers/ScriptSaverTest.java
test_class.identifier: ScriptSaverTest
test_case.body: @Test
  	public void testSaveUnicode() throws IOException
  	{
  		Instructions instructions = new Instructions();
  		instructions.init();
  		ScriptDefinition script = new Assembler(instructions).assemble(getClass().getResourceAsStream(SCRIPT_RESOURCE_UNICODE));
  		byte[] saved = new ScriptSaver().save(script);
  		ScriptDefinition loadedScripot = new ScriptLoader().load(1001, saved);
  		assertEquals(script, loadedScripot);
  	}
test_case.class_method_signature: ScriptSaverTest.testSaveUnicode()
test_case.full_signature: @Test public void testSaveUnicode()
test_case.identifier: testSaveUnicode
test_case.invocations: init assemble getResourceAsStream getClass save load assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSaveUnicode()
focal_class.file: cache/src/main/java/net/runelite/cache/definitions/savers/ScriptSaver.java
focal_class.identifier: ScriptSaver
focal_class.class_method_signature: ScriptSaver.save(ScriptDefinition script)
focal_class.full_signature: public byte[] save(ScriptDefinition script)
focal_class.identifier: save
focal_class.modifiers: public
focal_class.parameters: (ScriptDefinition script)
focal_class.return: byte[]
focal_class.signature: byte[] save(ScriptDefinition script)
focal_method.body: public byte[] save(ScriptDefinition script)
  	{
  		int[] instructions = script.getInstructions();
  		int[] intOperands = script.getIntOperands();
  		String[] stringOperands = script.getStringOperands();
  		Map<Integer, Integer>[] switches = script.getSwitches();
  
  		OutputStream out = new OutputStream();
  		out.writeByte(0); // null string
  		for (int i = 0; i < instructions.length; ++i)
  		{
  			int opcode = instructions[i];
  			out.writeShort(opcode);
  			if (opcode == SCONST)
  			{
  				out.writeString(stringOperands[i]);
  			}
  			else if (opcode < 100 && opcode != RETURN && opcode != POP_INT && opcode != POP_STRING)
  			{
  				out.writeInt(intOperands[i]);
  			}
  			else
  			{
  				out.writeByte(intOperands[i]);
  			}
  		}
  		out.writeInt(instructions.length);
  		out.writeShort(script.getLocalIntCount());
  		out.writeShort(script.getLocalStringCount());
  		out.writeShort(script.getIntStackCount());
  		out.writeShort(script.getStringStackCount());
  		int switchStart = out.getOffset();
  		if (switches == null)
  		{
  			out.writeByte(0);
  		}
  		else
  		{
  			out.writeByte(switches.length);
  			for (Map<Integer, Integer> s : switches)
  			{
  				out.writeShort(s.size());
  				for (Entry<Integer, Integer> e : s.entrySet())
  				{
  					out.writeInt(e.getKey());
  					out.writeInt(e.getValue());
  				}
  			}
  		}
  		int switchLength = out.getOffset() - switchStart;
  		out.writeShort(switchLength);
  		return out.flip();
  	}
focal_method.class_method_signature: ScriptSaver.save(ScriptDefinition script)
focal_method.full_signature: public byte[] save(ScriptDefinition script)
focal_method.identifier: save
focal_method.invocations: getInstructions getIntOperands getStringOperands getSwitches writeByte writeShort writeString writeInt writeByte writeInt writeShort getLocalIntCount writeShort getLocalStringCount writeShort getIntStackCount writeShort getStringStackCount getOffset writeByte writeByte writeShort size entrySet writeInt getKey writeInt getValue getOffset writeShort flip
focal_method.modifiers: public
focal_method.parameters: (ScriptDefinition script)
focal_method.return: byte[]
focal_method.signature: byte[] save(ScriptDefinition script)