/// <summary> /// Serialize the token data for communication between server and client. /// </summary> /// <exception cref="IOException"></exception> public void Serialize(DataOutputStream writer) { writer.WriteUTF(Id); writer.WriteUTF(Version); writer.WriteInt32(SourceFiles.Count); foreach (KeyValuePair <string, IList <RevisionFile> > pair in SourceFiles) { writer.WriteUTF(pair.Key); writer.WriteInt32(pair.Value.Count); foreach (RevisionFile file in pair.Value) { writer.WriteUTF(file.FileName); writer.WriteInt64(file.Length); } } }
/// <summary> /// Writes an ICU data header. /// Does not write a copyright string. /// </summary> /// <param name="dataFormat"></param> /// <param name="formatVersion"></param> /// <param name="dataVersion"></param> /// <param name="dos"></param> /// <returns>The length of the header (number of bytes written).</returns> /// <exception cref="IOException">From the <see cref="DataOutputStream"/>.</exception> public static int WriteHeader(int dataFormat, int formatVersion, int dataVersion, DataOutputStream dos) { // ucmndata.h MappedData dos.WriteChar(32); // headerSize dos.WriteByte(MAGIC1); dos.WriteByte(MAGIC2); // unicode/udata.h UDataInfo dos.WriteChar(20); // sizeof(UDataInfo) dos.WriteChar(0); // reservedWord dos.WriteByte(1); // isBigEndian dos.WriteByte(CHAR_SET_); // charsetFamily dos.WriteByte(CHAR_SIZE_); // sizeofUChar dos.WriteByte(0); // reservedByte dos.WriteInt32(dataFormat); dos.WriteInt32(formatVersion); dos.WriteInt32(dataVersion); // 8 bytes padding for 32 bytes headerSize (multiple of 16). dos.WriteInt64(0); Debug.Assert(dos.Length == 32); return(32); }