public virtual IReadBuffer Buffer(IReadBuffer buffer) { IReadBuffer temp = _buffer; _buffer = buffer; return(temp); }
private static DateTimeOffset ReadFrom(IReadBuffer buffer) { long ticks = buffer.ReadLong(); long timeSpanTicks = buffer.ReadLong(); return(new DateTimeOffset(ticks, new TimeSpan(timeSpanTicks))); }
private static Guid ReadFrom(IReadBuffer buffer) { var guidBytes = new byte[GuidSize]; buffer.ReadBytes(guidBytes); return(new Guid(guidBytes)); }
protected static ValueTask <T> ReadPending <T>(IReadBuffer <T> buffer, CancellationToken token = default) { ValueTask <T> result = buffer.ReadAsync(token); result.IsCompleted.Should().BeFalse(); return(result); }
protected static void Read <T>(IReadBuffer <T> buffer, T expected) { ValueTask <T> result = buffer.ReadAsync(CancellationToken.None); result.IsCompletedSuccessfully.Should().BeTrue(); result.Result.Should().Be(expected); }
public void Resize(IReadBuffer buffer, int newElements, int newByteStride = -1, IntPtr?newData = null) { MyRenderProxy.Assert(newElements > 0); MyRenderProxy.Assert(newByteStride > 0 || newByteStride == -1); ResizeInternal(buffer as MyReadBuffer, newElements, newByteStride, newData); }
public Worker(IReadBuffer readBuffer, IBlockDictionary writeBuffer, IStatistics stats, ISettings settings) { this.writeDictionary = writeBuffer; this.stats = stats; this.settings = settings; this.readBuffer = readBuffer; }
public virtual void ReadTypeInfo(Transaction trans, IReadBuffer buffer, ArrayInfo info, int classID) { BitMap4 typeInfoBitmap = new BitMap4(buffer.ReadByte()); info.Primitive(typeInfoBitmap.IsTrue(0)); info.Nullable(typeInfoBitmap.IsTrue(1)); }
public override string Read(IReadBuffer buffer, int length) { var bytes = new byte[length]; buffer.ReadBytes(bytes); return(Decode(bytes, 0, bytes.Length)); }
public IReadBuffer <byte> GetBinaryReadBuffer(int size) { if (m_binaryReadBuffer == null) { m_binaryReadBuffer = this.CreateBinaryReadBuffer(size); } return(m_binaryReadBuffer); }
public IReadBuffer <char> GetTextualReadBuffer(int size) { if (m_textualReadBuffer == null) { m_textualReadBuffer = this.CreateTextualReadBuffer(size); } return(m_textualReadBuffer); }
public _IClosure4_318(QCandidate _enclosing, ITypeHandler4 arrayElementHandler, IReadBuffer buffer, QCandidates candidates) { this._enclosing = _enclosing; this.arrayElementHandler = arrayElementHandler; this.buffer = buffer; this.candidates = candidates; }
private void PrepareReader(out IReadBuffer readBuffer, out IReader sut) { var settings = kernel.Get <ISettings>(); settings.Mode = System.IO.Compression.CompressionMode.Compress; readBuffer = new ReadBuffer(settings, kernel.Get <IBlockQueue>(), kernel.Get <IBlockQueue>(), 0); sut = new Reader(kernel.Get <IStatistics>(), settings, readBuffer); }
protected override void SeekSecondaryOffset(IReadBuffer buffer, ITypeHandler4 typeHandler ) { if (Handlers4.HandlesPrimitiveArray(typeHandler)) { buffer.Seek(buffer.ReadInt()); } }
public virtual string Read(IReadBuffer buffer, int length) { char[] chars = new char[length]; for (int ii = 0; ii < length; ii++) { chars[ii] = (char)(buffer.ReadByte() & unchecked ((int)(0xff))); } return(new string(chars, 0, length)); }
public virtual object DoWithSlotIndirection(IReadBuffer buffer, ITypeHandler4 typeHandler , IClosure4 closure) { if (!IsIndirectedWithinSlot(typeHandler)) { return closure.Run(); } return DoWithSlotIndirection(buffer, closure); }
public virtual object DoWithSlotIndirection(IReadBuffer buffer, ITypeHandler4 typeHandler , IClosure4 closure) { if (!IsIndirectedWithinSlot(typeHandler)) { return(closure.Run()); } return(DoWithSlotIndirection(buffer, closure)); }
public virtual string Read(IReadBuffer buffer, int length) { char[] chars = new char[length]; for (int ii = 0; ii < length; ii++) { chars[ii] = (char)(buffer.ReadByte() & unchecked((int)(0xff))); } return new string(chars, 0, length); }
private int ReducedCountForNullBitMap(ArrayInfo info, IReadBuffer context) { if (!HasNullBitmap(info)) { return(0); } return(ReducedCountForNullBitMap(info.ElementCount(), ReadNullBitmap(context, info .ElementCount()))); }
public virtual string ReadLengthAndString(IReadBuffer buffer) { int length = buffer.ReadInt(); if (length == 0) { return string.Empty; } return Read(buffer, length); }
public override string Read(IReadBuffer buffer, int length) { var chars = new char[length]; for (var ii = 0; ii < length; ii++) { chars[ii] = (char) ((buffer.ReadByte() & unchecked(0xff)) | ((buffer.ReadByte () & unchecked(0xff)) << 8)); } return new string(chars, 0, length); }
private KeyValueHandlerPair ReadKeyValueTypeHandlers(IReadBuffer buffer, IContext context) { buffer.ReadInt(); buffer.ReadInt(); ITypeHandler4 untypedHandler = (ITypeHandler4)Container(context).Handlers.OpenTypeHandler (); return(new KeyValueHandlerPair(untypedHandler, untypedHandler)); }
private QueryingReadContext(Transaction transaction, QCandidates candidates, int handlerVersion, IReadBuffer buffer, int collectionID, IdObjectCollector collector ) : base(transaction, buffer) { _candidates = candidates; _activationDepth = new LegacyActivationDepth(0); _collectionID = collectionID; _handlerVersion = handlerVersion; _collector = collector; }
public virtual string ReadLengthAndString(IReadBuffer buffer) { var length = buffer.ReadInt(); if (length == 0) { return(string.Empty); } return(Read(buffer, length)); }
public static void ReadEnd(IReadBuffer buffer) { if (Deploy.debug && Deploy.brackets) { if (buffer.ReadByte() != Const4.Yapend) { throw new Exception("Debug.readEnd() YAPEND expected"); } } }
private void ReadDimensions(ArrayInfo info, IReadBuffer buffer, int dimensionCount ) { var dim = new int[dimensionCount]; for (var i = 0; i < dim.Length; i++) { dim[i] = buffer.ReadInt(); } ((MultidimensionalArrayInfo) info).Dimensions(dim); info.ElementCount(ElementCount(dim)); }
protected static void ReadFailed <T, TException>(IReadBuffer <T> buffer, CancellationToken token = default) where TException : Exception { ValueTask <T> result = buffer.ReadAsync(token); result.IsCompleted.Should().BeTrue(); result.IsCompletedSuccessfully.Should().BeFalse(); Action act = () => _ = result.Result; act.Should().Throw <TException>(); }
private void ReadDimensions(ArrayInfo info, IReadBuffer buffer, int dimensionCount ) { int[] dim = new int[dimensionCount]; for (int i = 0; i < dim.Length; i++) { dim[i] = buffer.ReadInt(); } ((MultidimensionalArrayInfo)info).Dimensions(dim); info.ElementCount(ElementCount(dim)); }
private void ReadArrayCandidates(ITypeHandler4 typeHandler, IReadBuffer buffer, ITypeHandler4 arrayElementHandler, QCandidates candidates) { if (!Handlers4.IsCascading(arrayElementHandler)) { return; } SlotFormat slotFormat = SlotFormat.ForHandlerVersion(_handlerVersion); slotFormat.DoWithSlotIndirection(buffer, typeHandler, new _IClosure4_318(this, arrayElementHandler , buffer, candidates)); }
public override string Read(IReadBuffer buffer, int length) { var chars = new char[length]; for (var ii = 0; ii < length; ii++) { chars[ii] = (char)((buffer.ReadByte() & unchecked (0xff)) | ((buffer.ReadByte () & unchecked (0xff)) << 8)); } return(new string(chars, 0, length)); }
protected virtual object ReadCreate(Transaction trans, IReadBuffer buffer, ArrayInfo info) { ReadInfo(trans, buffer, info); IReflectClass clazz = NewInstanceReflectClass(trans.Reflector(), info); if (clazz == null) { return(null); } return(NewInstance(ArrayReflector(Container(trans)), info, clazz)); }
private static ITypeHandler4 ReadElementTypeHandler(IReadBuffer buffer, IContext context) { int elementTypeId = buffer.ReadInt(); if (elementTypeId == 0) { return(OpenTypeHandlerFrom(context)); } ITypeHandler4 elementHandler = Container(context).TypeHandlerForClassMetadataID(elementTypeId); return(elementHandler ?? OpenTypeHandlerFrom(context)); }
public static long ReadLong(IReadBuffer buffer) { long ret = 0; if (Deploy.debug && Deploy.debugLong) { ret = long.Parse(new LatinStringIO().Read(buffer, Const4.LongBytes).Trim()); } for (var i = 0; i < Const4.LongBytes; i++) { ret = (ret << 8) + (buffer.ReadByte() & unchecked(0xff)); } return ret; }
public static long ReadLong(IReadBuffer buffer) { long ret = 0; if (Deploy.debug && Deploy.debugLong) { ret = long.Parse(new LatinStringIO().Read(buffer, Const4.LongBytes).Trim()); } for (var i = 0; i < Const4.LongBytes; i++) { ret = (ret << 8) + (buffer.ReadByte() & unchecked (0xff)); } return(ret); }
public virtual object DoWithSlotIndirection(IReadBuffer buffer, IClosure4 closure ) { int payLoadOffset = buffer.ReadInt(); buffer.ReadInt(); // length, not used int savedOffset = buffer.Offset(); object res = null; if (payLoadOffset != 0) { buffer.Seek(payLoadOffset); res = closure.Run(); } buffer.Seek(savedOffset); return res; }
internal PersistentChannelReader(IChannelReader <T> reader, bool singleReader) { this.reader = reader; if (singleReader) { readLock = default; buffer = new SingleReaderBuffer(); } else { readLock = AsyncLock.Exclusive(); buffer = new MultipleReadersBuffer(); } fileOptions = new FileCreationOptions(FileMode.Open, FileAccess.Read, FileShare.ReadWrite, FileOptions.Asynchronous | FileOptions.SequentialScan); cursor = new ChannelCursor(reader.Location, StateFileName); }
protected override void WithContent(AbstractBufferContext context, IRunnable runnable ) { int address = context.ReadInt(); int length = context.ReadInt(); if (address == 0) { return; } IReadBuffer temp = context.Buffer(); ByteArrayBuffer indirectedBuffer = Container(context).DecryptedBufferByAddress(address , length); context.Buffer(indirectedBuffer); runnable.Run(); context.Buffer(temp); }
protected virtual void ReadInfo(Transaction trans, IReadBuffer buffer, ArrayInfo info) { int classID = buffer.ReadInt(); if (IsPreVersion0Format(classID)) { throw new UnsupportedOldFormatException(); } else { _versionHelper.ReadTypeInfo(trans, buffer, info, classID); ReflectClassFromElementsEntry(Container(trans), info, classID); ReadDimensions(info, buffer); } if (Debug4.ExceedsMaximumArrayEntries(info.ElementCount(), _usePrimitiveClassReflector )) { info.ElementCount(0); } }
public _CollectIdContext_203(QueryingReadContext readContext, Transaction baseArg1 , IdObjectCollector baseArg2, ObjectHeader baseArg3, IReadBuffer baseArg4) : base (baseArg1, baseArg2, baseArg3, baseArg4) { this.readContext = readContext; }
/// <param name="buffer"></param> /// <param name="typeHandler"></param> protected virtual void SeekSecondaryOffset(IReadBuffer buffer, ITypeHandler4 typeHandler ) { }
public static string ReadString(IContext context, IReadBuffer buffer) { var str = ReadStringNoDebug(context, buffer); return str; }
public static string ReadStringNoDebug(IContext context, IReadBuffer buffer) { return Intern(context, StringIo(context).ReadLengthAndString(buffer)); }
public override string Read(IReadBuffer buffer, int length) { byte[] bytes = new byte[length]; buffer.ReadBytes(bytes); return Decode(bytes, 0, bytes.Length); }
private static Guid ReadFrom(IReadBuffer buffer) { byte[] guidBytes = new byte[GuidSize]; buffer.ReadBytes(guidBytes); return new Guid(guidBytes); }
private static ITypeHandler4 ReadElementTypeHandler(IReadBuffer buffer, IContext context) { int elementHandlerId = buffer.ReadInt(); if (elementHandlerId == 0) return OpenTypeHandlerFrom(context); ITypeHandler4 elementHandler = Container(context).TypeHandlerForClassMetadataID(elementHandlerId); return elementHandler ?? OpenTypeHandlerFrom(context); }
protected AbstractReadContext(Transaction transaction, IReadBuffer buffer) : base (transaction, buffer) { }
private void ReadArrayCandidates(ITypeHandler4 typeHandler, IReadBuffer buffer, ITypeHandler4 arrayElementHandler, QCandidates candidates) { if (!Handlers4.IsCascading(arrayElementHandler)) { return; } var slotFormat = SlotFormat.ForHandlerVersion(_handlerVersion); slotFormat.DoWithSlotIndirection(buffer, typeHandler, new _IClosure4_318(this, arrayElementHandler , buffer, candidates)); }
private int ReducedCountForNullBitMap(ArrayInfo info, IReadBuffer context) { if (!HasNullBitmap(info)) { return 0; } return ReducedCountForNullBitMap(info.ElementCount(), ReadNullBitmap(context, info .ElementCount())); }
// do nothing, the byte for additional type information was added after format 3 public override void ReadTypeInfo(Transaction trans, IReadBuffer buffer, ArrayInfo info, int classID) { }
public static void ReadBegin(IReadBuffer buffer, byte identifier) { }
protected virtual void ReadDimensions(ArrayInfo info, IReadBuffer buffer) { info.ElementCount(buffer.ReadInt()); }
protected virtual object ReadCreate(Transaction trans, IReadBuffer buffer, ArrayInfo info) { ReadInfo(trans, buffer, info); IReflectClass clazz = NewInstanceReflectClass(trans.Reflector(), info); if (clazz == null) { return null; } return NewInstance(ArrayReflector(Container(trans)), info, clazz); }
protected virtual BitMap4 ReadNullBitmap(IReadBuffer context, int length) { return context.ReadBitMap(length); }
public ObjectIdContextImpl(Transaction transaction, IReadBuffer buffer, ObjectHeader objectHeader, int id) : base(transaction, buffer, objectHeader) { _id = id; }
private KeyValueHandlerPair ReadKeyValueTypeHandlers(IReadBuffer buffer, IContext context) { buffer.ReadInt(); buffer.ReadInt(); ITypeHandler4 untypedHandler = (ITypeHandler4)Container(context).Handlers.OpenTypeHandler (); return new KeyValueHandlerPair(untypedHandler, untypedHandler); }