nativeDataStream.d.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import type { DeepImmutable, FloatArray } from "../../types";
  2. /** @internal */
  3. export type NativeData = Uint32Array;
  4. /** @internal */
  5. export declare class NativeDataStream {
  6. private readonly _uint32s;
  7. private readonly _int32s;
  8. private readonly _float32s;
  9. private readonly _length;
  10. private _position;
  11. private readonly _nativeDataStream;
  12. private static readonly DEFAULT_BUFFER_SIZE;
  13. constructor();
  14. /**
  15. * Writes a uint32 to the stream
  16. * @param value the value to write
  17. */
  18. writeUint32(value: number): void;
  19. /**
  20. * Writes an int32 to the stream
  21. * @param value the value to write
  22. */
  23. writeInt32(value: number): void;
  24. /**
  25. * Writes a float32 to the stream
  26. * @param value the value to write
  27. */
  28. writeFloat32(value: number): void;
  29. /**
  30. * Writes a uint32 array to the stream
  31. * @param values the values to write
  32. */
  33. writeUint32Array(values: Uint32Array): void;
  34. /**
  35. * Writes an int32 array to the stream
  36. * @param values the values to write
  37. */
  38. writeInt32Array(values: Int32Array): void;
  39. /**
  40. * Writes a float32 array to the stream
  41. * @param values the values to write
  42. */
  43. writeFloat32Array(values: DeepImmutable<FloatArray>): void;
  44. /**
  45. * Writes native data to the stream
  46. * @param handle the handle to the native data
  47. */
  48. writeNativeData(handle: NativeData): void;
  49. /**
  50. * Writes a boolean to the stream
  51. * @param value the value to write
  52. */
  53. writeBoolean(value: boolean): void;
  54. private _flushIfNecessary;
  55. private _flush;
  56. }