Files
i2ME/TWC.Util/DataProvider/StringDataProvider.cs
T
2024-12-17 16:26:07 -08:00

44 lines
957 B
C#

using System;
using System.Text;
namespace TWC.Util.DataProvider
{
public class StringDataProvider : Disposable, IDataProvider, IDisposable
{
private string s;
private uint offset;
public StringDataProvider(string s)
{
this.s = s;
}
public uint Count
{
get
{
return (uint)this.s.Length;
}
}
public uint CountRemaining
{
get
{
return (uint)this.s.Length - this.offset;
}
}
public void Start()
{
this.offset = 0U;
}
public void GetNextBytes(ref byte[] buf, uint pos, uint count)
{
Encoding.GetEncoding("iso-8859-1").GetBytes(this.s, (int)this.offset, (int)count, buf, (int)pos);
this.offset += count;
}
}
}