public static void WriteLong(ByteArrayOutputStream @out, long val) { for (int i = 0; i < LongLength; i++) { @out.Write((byte)(val >> ((7 - i) * 8))); } }
public static void WriteInt(ByteArrayOutputStream @out, int val) { @out.Write((byte)(val >> 24)); @out.Write((byte)(val >> 16)); @out.Write((byte)(val >> 8)); @out.Write((byte)val); }
public void Encode(ByteArrayOutputStream os, IObjectInfo info) { PrimitiveCodec.WriteLong(os, info.GetInternalID()); long sourceDatabaseId = ((FrozenObjectInfo)info).SourceDatabaseId(this._enclosing .Transaction()); PrimitiveCodec.WriteLong(os, sourceDatabaseId); PrimitiveCodec.WriteLong(os, ((FrozenObjectInfo)info).UuidLongPart()); PrimitiveCodec.WriteLong(os, info.GetCommitTimestamp()); }
private void EncodeObjectInfoCollection(ByteArrayOutputStream os, IObjectInfoCollection collection, IObjectInfoEncoder encoder) { var iter = collection.GetEnumerator(); while (iter.MoveNext()) { var obj = (IObjectInfo) iter.Current; encoder.Encode(os, obj); } PrimitiveCodec.WriteLong(os, -1); }
private byte[] EncodeInfo(CallbackObjectInfoCollections callbackInfo, ByteArrayOutputStream os) { EncodeObjectInfoCollection(os, callbackInfo.added, new InternalIDEncoder (this)); EncodeObjectInfoCollection(os, callbackInfo.deleted, new FrozenObjectInfoEncoder (this)); EncodeObjectInfoCollection(os, callbackInfo.updated, new InternalIDEncoder (this)); return os.ToByteArray(); }
public virtual MCommittedInfo Encode(CallbackObjectInfoCollections callbackInfo, int dispatcherID) { var os = new ByteArrayOutputStream(); PrimitiveCodec.WriteInt(os, dispatcherID); var bytes = EncodeInfo(callbackInfo, os); var committedInfo = (MCommittedInfo) GetWriterForLength(Transaction(), bytes.Length + Const4.IntLength); committedInfo._payLoad.Append(bytes); return committedInfo; }
public void Encode(ByteArrayOutputStream os, IObjectInfo info) { PrimitiveCodec.WriteLong(os, info.GetInternalID()); }
/// <exception cref="System.IO.IOException"></exception> protected virtual void WriteByteArray(ByteArrayOutputStream os, byte[] signaturePart ) { PrimitiveCodec.WriteLong(os, signaturePart.Length); os.Write(signaturePart); }
/// <exception cref="System.Security.SecurityException"></exception> /// <exception cref="System.MissingMethodException"></exception> public virtual void TestPrintWriterLogger() { ByteArrayOutputStream bout = new ByteArrayOutputStream(); PrintWriterLoggerInterceptor interceptor = new PrintWriterLoggerInterceptor(new PrintWriter (bout, true)); Logger.Intercept(interceptor); ILogging logger = Logger.Get(typeof(LoggingTestCase.ITestLogger)); ((LoggingTestCase.ITestLogger)logger.Debug()).Msg(); ((LoggingTestCase.ITestLogger)logger.Info()).Msg(); string actual = Platform4.AsUtf8(bout.ToByteArray()); string debugMsg = PrintWriterLoggerInterceptor.FormatMessage(Logger.Debug, "msg", null); string infoMsg = PrintWriterLoggerInterceptor.FormatMessage(Logger.Info, "msg", null ); Assert.IsTrue((actual.IndexOf(debugMsg) >= 0)); Assert.IsTrue((actual.IndexOf(infoMsg) >= 0)); }