public void Set(MutableString /*!*/ pattern, RubyRegexOptions options) { ContractUtils.RequiresNotNull(pattern, "pattern"); // RubyRegexOptions.Once is only used to determine how the Regexp object should be created and cached. // It is not a property of the final object. /foo/ should compare equal with /foo/o. _options = options & ~RubyRegexOptions.Once; RubyEncoding encoding = RubyEncoding.GetRegexEncoding(options); if (encoding != null || pattern.Encoding.IsKCoding) { _pattern = MutableString.CreateBinary(pattern.ToByteArray(), encoding ?? RubyEncoding.Binary).Freeze(); } else { _pattern = pattern.PrepareForCharacterRead().Clone().Freeze(); } TransformPattern(encoding, options & RubyRegexOptions.EncodingMask); }
private void WriteStringValue(MutableString /*!*/ value) { byte[] data = value.ToByteArray(); WriteInt32(data.Length); _writer.Write(data); }
// returns the number of bytes written to the stream: public int Write(MutableString /*!*/ value) { byte[] bytes = value.ToByteArray(); return(Write(bytes, 0, bytes.Length)); }