本文整理汇总了C#中com.asQuotedChars方法的典型用法代码示例。如果您正苦于以下问题:C# com.asQuotedChars方法的具体用法?C# com.asQuotedChars怎么用?C# com.asQuotedChars使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com
的用法示例。
在下文中一共展示了com.asQuotedChars方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _writePPFieldName
/// <exception cref="System.IO.IOException"/>
/// <exception cref="com.fasterxml.jackson.core.JsonGenerationException"/>
protected internal void _writePPFieldName(com.fasterxml.jackson.core.SerializableString
name, bool commaBefore)
{
if (commaBefore)
{
_cfgPrettyPrinter.writeObjectEntrySeparator(this);
}
else
{
_cfgPrettyPrinter.beforeObjectEntries(this);
}
char[] quoted = name.asQuotedChars();
if (isEnabled(com.fasterxml.jackson.core.JsonGenerator.Feature.QUOTE_FIELD_NAMES))
{
// standard
if (_outputTail >= _outputEnd)
{
_flushBuffer();
}
_outputBuffer[_outputTail++] = '"';
writeRaw(quoted, 0, quoted.Length);
if (_outputTail >= _outputEnd)
{
_flushBuffer();
}
_outputBuffer[_outputTail++] = '"';
}
else
{
// non-standard, omit quotes
writeRaw(quoted, 0, quoted.Length);
}
}
示例2: writeString
/// <exception cref="System.IO.IOException"/>
public override void writeString(com.fasterxml.jackson.core.SerializableString sstr
)
{
_verifyValueWrite(WRITE_STRING);
if (_outputTail >= _outputEnd)
{
_flushBuffer();
}
_outputBuffer[_outputTail++] = '"';
// Note: copied from writeRaw:
char[] text = sstr.asQuotedChars();
int len = text.Length;
// Only worth buffering if it's a short write?
if (len < SHORT_WRITE)
{
int room = _outputEnd - _outputTail;
if (len > room)
{
_flushBuffer();
}
System.Array.Copy(text, 0, _outputBuffer, _outputTail, len);
_outputTail += len;
}
else
{
// Otherwise, better just pass through:
_flushBuffer();
_writer.write(text, 0, len);
}
if (_outputTail >= _outputEnd)
{
_flushBuffer();
}
_outputBuffer[_outputTail++] = '"';
}
示例3: _writeFieldName
/// <exception cref="System.IO.IOException"/>
protected internal void _writeFieldName(com.fasterxml.jackson.core.SerializableString
name, bool commaBefore)
{
if (_cfgPrettyPrinter != null)
{
_writePPFieldName(name, commaBefore);
return;
}
// for fast+std case, need to output up to 2 chars, comma, dquote
if ((_outputTail + 1) >= _outputEnd)
{
_flushBuffer();
}
if (commaBefore)
{
_outputBuffer[_outputTail++] = ',';
}
/* To support [JACKSON-46], we'll do this:
* (Question: should quoting of spaces (etc) still be enabled?)
*/
char[] quoted = name.asQuotedChars();
if (!isEnabled(com.fasterxml.jackson.core.JsonGenerator.Feature.QUOTE_FIELD_NAMES
))
{
writeRaw(quoted, 0, quoted.Length);
return;
}
// we know there's room for at least one more char
_outputBuffer[_outputTail++] = '"';
// The beef:
int qlen = quoted.Length;
if ((_outputTail + qlen + 1) >= _outputEnd)
{
writeRaw(quoted, 0, qlen);
// and closing quotes; need room for one more char:
if (_outputTail >= _outputEnd)
{
_flushBuffer();
}
_outputBuffer[_outputTail++] = '"';
}
else
{
System.Array.Copy(quoted, 0, _outputBuffer, _outputTail, qlen);
_outputTail += qlen;
_outputBuffer[_outputTail++] = '"';
}
}