public final void marshal(ThreadContext context, InvocationBuffer buffer, IRubyObject parameter) {
if (parameter instanceof RubyString) {
StringSupport.checkStringSafety(context.getRuntime(), parameter);
ByteList bl = ((RubyString) parameter).getByteList();
buffer.putArray(bl.getUnsafeBytes(), bl.begin(), bl.length(),
ArrayFlags.IN | ArrayFlags.NULTERMINATE);
} else if (parameter.isNil()) {
buffer.putAddress(0);
} else {
throw context.getRuntime().newArgumentError("Invalid string parameter");