fixed C# bytebuffer put methods

This commit is contained in:
Maor Itzkovitch
2015-08-07 10:51:15 +03:00
parent 7196c36842
commit e4c3bf3d2c
3 changed files with 39 additions and 11 deletions

View File

@@ -35,13 +35,18 @@ namespace FlatBuffers
public byte[] Data { get { return _buffer; } }
public ByteBuffer(byte[] buffer)
public ByteBuffer(byte[] buffer) : this(buffer, 0) { }
public ByteBuffer(byte[] buffer, int pos)
{
_buffer = buffer;
_pos = 0;
_pos = pos;
}
public int Position { get { return _pos; } }
public int Position {
get { return _pos; }
set { _pos = value; }
}
// Pre-allocated helper arrays for convertion.
private float[] floathelper = new[] { 0.0f };
@@ -92,7 +97,6 @@ namespace FlatBuffers
_buffer[offset + count - 1 - i] = (byte)(data >> i * 8);
}
}
_pos = offset;
}
protected ulong ReadLittleEndian(int offset, int count)
@@ -129,14 +133,12 @@ namespace FlatBuffers
{
AssertOffsetAndLength(offset, sizeof(sbyte));
_buffer[offset] = (byte)value;
_pos = offset;
}
public void PutByte(int offset, byte value)
{
AssertOffsetAndLength(offset, sizeof(byte));
_buffer[offset] = value;
_pos = offset;
}
// this method exists in order to conform with Java ByteBuffer standards