示例#1
0
 public TreeEncoderStream(IWriter <TState, TNative> reader, WriterCallback <TState, TNative, TEntity> callback,
                          TState state)
 {
     this.callback = callback;
     this.reader   = reader;
     this.state    = state;
 }
示例#2
0
        public void WriteAsArray <TEntity>(WriterState state, IEnumerable <TEntity> elements,
                                           WriterCallback <WriterState, RawProtobufValue, TEntity> writer)
        {
            foreach (var element in elements)
            {
                var fieldIndex = state.FieldIndex;

                writer(this, state, element);

                state.FieldIndex = fieldIndex;
            }
        }
示例#3
0
        public void WriteAsArray <TElement>(WriterState state, IEnumerable <TElement> elements,
                                            WriterCallback <WriterState, JSONValue, TElement> writer)
        {
            if (elements == null)
            {
                this.WriteAsValue(state, JSONValue.Void);
            }
            else
            {
                state.ArrayBegin();

                foreach (var element in elements)
                {
                    writer(this, state, element);
                }

                state.ArrayEnd();
            }
        }
示例#4
0
 public TreeEncoder(IWriter <TState, TNative> reader, WriterCallback <TState, TNative, TEntity> callback)
 {
     this.callback = callback;
     this.reader   = reader;
 }
示例#5
0
 /**
  * Add a listener for when the stripe and file are about to be closed.
  * @param callback the object to be called when the stripe is closed
  * @return this
  */
 public WriterOptions callback(WriterCallback callback)
 {
     _callback = callback;
     return(this);
 }
示例#6
0
 public void WriteAsArray <TEntity>(WriterState state, IEnumerable <TEntity> elements,
                                    WriterCallback <WriterState, ProtobufValue, TEntity> writer)
 {
     throw new NotImplementedException();
 }
示例#7
0
 /**
  * Add a listener for when the stripe and file are about to be closed.
  * @param callback the object to be called when the stripe is closed
  * @return this
  */
 public WriterOptions callback(WriterCallback callback)
 {
     _callback = callback;
     return this;
 }