void WriteStringAtSymbol(int symbolIndex, int symbol, string str, PropertyStringHashAndLength hashAndLength) { using (LockWrite()) { WriteSymbol(symbolIndex, symbol); m_Fs.Seek(GetStringsOffset() + symbol, SeekOrigin.Begin); WriteInt32(hashAndLength.length); if (m_StringBuffer.Length < hashAndLength.length) { m_StringBuffer = new byte[hashAndLength.length]; } PropertyStringTable.encoding.GetBytes(str, 0, str.Length, m_StringBuffer, 0); m_Fs.Write(m_StringBuffer, 0, hashAndLength.length); m_Header.count++; m_Header.usedStringBytes += PropertyStringTable.StringLengthByteSize + hashAndLength.length; // Notify other views that the WriteHeader(false); if (!m_DelayedSync) { Sync(); } } }
void WriteStringAtSymbol(int symbolIndex, int symbol, string str, PropertyStringHashAndLength hashAndLength) { using (LockWrite()) { WriteSymbol(symbolIndex, symbol); m_Fs.Seek(GetStringsOffset() + symbol, SeekOrigin.Begin); WriteInt32(hashAndLength.length); m_Bw.Write(str); m_Header.count++; m_Header.usedStringBytes += PropertyStringTable.stringLengthByteSize + hashAndLength.length; // Notify other views that the WriteHeader(false); if (!m_DelayedSync) { Sync(); } } }
public static int GetStringByteSize(int stringLength) { var maxByteCount = encoding.GetMaxByteCount(stringLength); return(maxByteCount + PropertyStringHashAndLength.GetSevenBitEncodedIntByteSize(maxByteCount) + StringLengthByteSize); }