SimpleTextDecoder.ets 312 B

12345678910111213141516171819
  1. export class SimpleTextDecoder {
  2. encoding: string;
  3. constructor(encoding: string) {
  4. this.encoding = encoding;
  5. }
  6. decode(buffer: Uint8Array): string {
  7. let result = '';
  8. for (let i = 0; i < buffer.length; i++) {
  9. result += String.fromCharCode(buffer[i]);
  10. }
  11. return result;
  12. }
  13. }