Esempio n. 1
0
		public static void WriteLong(ByteArrayOutputStream @out, long val)
		{
			for (int i = 0; i < LongLength; i++)
			{
				@out.Write((byte)(val >> ((7 - i) * 8)));
			}
		}
Esempio n. 2
0
		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);
		}
Esempio n. 3
0
			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());
			}
Esempio n. 4
0
 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);
 }
Esempio n. 5
0
 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();
 }
Esempio n. 6
0
 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;
 }
Esempio n. 7
0
 public void Encode(ByteArrayOutputStream os, IObjectInfo info)
 {
     PrimitiveCodec.WriteLong(os, info.GetInternalID());
 }
Esempio n. 8
0
 /// <exception cref="System.IO.IOException"></exception>
 protected virtual void WriteByteArray(ByteArrayOutputStream os, byte[] signaturePart
     )
 {
     PrimitiveCodec.WriteLong(os, signaturePart.Length);
     os.Write(signaturePart);
 }
Esempio n. 9
0
		/// <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));
		}