@sswroom/sswr 1.5.5 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/data.js CHANGED
@@ -80,6 +80,23 @@ export function arrayBuffer2Base64(buff)
80
80
  return btoa(String.fromCharCode.apply(null, new Uint8Array(buff)));
81
81
  }
82
82
 
83
+ export function arrayBufferEquals(buff1, buff2)
84
+ {
85
+ let arr1 = new Uint8Array(buff1);
86
+ let arr2 = new Uint8Array(buff2);
87
+ if (arr1.byteLength != arr2.byteLength)
88
+ return false;
89
+ let i = 0;
90
+ let j = arr1.length;
91
+ while (i < j)
92
+ {
93
+ if (arr1[i] != arr2[i])
94
+ return false;
95
+ i++;
96
+ }
97
+ return true;
98
+ }
99
+
83
100
  export function compare(a, b)
84
101
  {
85
102
  if (a == b)
@@ -280,6 +297,37 @@ export function readMUInt32(arr, index)
280
297
  return arr[index + 3] | (arr[index + 2] << 8) | (arr[index + 1] << 16) | (arr[index + 0] << 24);
281
298
  }
282
299
 
300
+ export function rol32(v, n)
301
+ {
302
+ if (n == 0)
303
+ return v;
304
+ return ((v << n) | ((v >> 1) & 0x7fffffff) >> (31 - n));
305
+ }
306
+
307
+ export function ror32(v, n)
308
+ {
309
+ if (n == 0)
310
+ return v;
311
+ return ((v << (32 - n)) | ((v >> 1) & 0x7fffffff) >> (n - 1));
312
+ }
313
+
314
+ export function shl32(v, n)
315
+ {
316
+ return v << n;
317
+ }
318
+
319
+ export function sar32(v, n)
320
+ {
321
+ return v >> n;
322
+ }
323
+
324
+ export function shr32(v, n)
325
+ {
326
+ if (n == 0)
327
+ return v;
328
+ return ((v >> 1) & 0x7fffffff) >> (n - 1);
329
+ }
330
+
283
331
  export class DateValue
284
332
  {
285
333
  constructor()
@@ -474,12 +522,12 @@ export class DateTimeUtil
474
522
 
475
523
  static timeValue2Secs(tval)
476
524
  {
477
- return DateTimeUtil.dateValue2TotalDays(tval) * 86400 + (tval.second + tval.minute * 60 + tval.hour * 3600 - tval.tzQhr * 900);
525
+ return BigInt(DateTimeUtil.dateValue2TotalDays(tval)) * 86400n + BigInt(tval.second + tval.minute * 60 + tval.hour * 3600 - tval.tzQhr * 900);
478
526
  }
479
527
 
480
528
  static timeValue2Ticks(t)
481
529
  {
482
- return DateTimeUtil.timeValue2Secs(t) * 1000 + Math.floor(t.nanosec / 1000000);
530
+ return DateTimeUtil.timeValue2Secs(t) * 1000n + Math.floor(t.nanosec / 1000000);
483
531
  }
484
532
 
485
533
  static ticks2TimeValue(ticks, tzQhr)
@@ -543,14 +591,14 @@ export class DateTimeUtil
543
591
  }
544
592
  else
545
593
  {
546
- totalDays -= 10957;
547
- t.year = (2000 + (Math.floor(totalDays / 1461) * 4));
548
- totalDays = totalDays % 1461;
549
- if (totalDays >= 366)
594
+ totalDays -= 10957n;
595
+ t.year = (2000 + (Math.floor(Number(totalDays) / 1461) * 4));
596
+ totalDays = totalDays % 1461n;
597
+ if (totalDays >= 366n)
550
598
  {
551
599
  totalDays--;
552
- t.year = (t.year + Math.floor(totalDays / 365));
553
- totalDays = totalDays % 365;
600
+ t.year = (t.year + Math.floor(Number(totalDays) / 365));
601
+ totalDays = totalDays % 365n;
554
602
  }
555
603
  }
556
604
 
@@ -563,24 +611,24 @@ export class DateTimeUtil
563
611
  if (totalDays < 31)
564
612
  {
565
613
  t.month = 1;
566
- t.day = (totalDays + 1);
614
+ t.day = (Number(totalDays) + 1);
567
615
  }
568
616
  else
569
617
  {
570
618
  t.month = 2;
571
- t.day = (totalDays - 31 + 1);
619
+ t.day = (Number(totalDays) - 31 + 1);
572
620
  }
573
621
  }
574
622
  else
575
623
  if (totalDays < 91)
576
624
  {
577
625
  t.month = 3;
578
- t.day = (totalDays - 60 + 1);
626
+ t.day = (Number(totalDays) - 60 + 1);
579
627
  }
580
628
  else
581
629
  {
582
630
  t.month = 4;
583
- t.day = (totalDays - 91 + 1);
631
+ t.day = (Number(totalDays) - 91 + 1);
584
632
  }
585
633
  }
586
634
  else
@@ -592,24 +640,24 @@ export class DateTimeUtil
592
640
  if (totalDays < 152)
593
641
  {
594
642
  t.month = 5;
595
- t.day = (totalDays - 121 + 1);
643
+ t.day = (Number(totalDays) - 121 + 1);
596
644
  }
597
645
  else
598
646
  {
599
647
  t.month = 6;
600
- t.day = (totalDays - 152 + 1);
648
+ t.day = (Number(totalDays) - 152 + 1);
601
649
  }
602
650
  }
603
651
  else
604
652
  if (totalDays < 213)
605
653
  {
606
654
  t.month = 7;
607
- t.day = (totalDays - 182 + 1);
655
+ t.day = (Number(totalDays) - 182 + 1);
608
656
  }
609
657
  else
610
658
  {
611
659
  t.month = 8;
612
- t.day = (totalDays - 213 + 1);
660
+ t.day = (Number(totalDays) - 213 + 1);
613
661
  }
614
662
  }
615
663
  else
@@ -619,24 +667,24 @@ export class DateTimeUtil
619
667
  if (totalDays < 274)
620
668
  {
621
669
  t.month = 9;
622
- t.day = (totalDays - 244 + 1);
670
+ t.day = (Number(totalDays) - 244 + 1);
623
671
  }
624
672
  else
625
673
  {
626
674
  t.month = 10;
627
- t.day = (totalDays - 274 + 1);
675
+ t.day = (Number(totalDays) - 274 + 1);
628
676
  }
629
677
  }
630
678
  else
631
679
  if (totalDays < 335)
632
680
  {
633
681
  t.month = 11;
634
- t.day = (totalDays - 305 + 1);
682
+ t.day = (Number(totalDays) - 305 + 1);
635
683
  }
636
684
  else
637
685
  {
638
686
  t.month = 12;
639
- t.day = (totalDays - 335 + 1);
687
+ t.day = (Number(totalDays) - 335 + 1);
640
688
  }
641
689
  }
642
690
  }
@@ -650,24 +698,24 @@ export class DateTimeUtil
650
698
  if (totalDays < 31)
651
699
  {
652
700
  t.month = 1;
653
- t.day = (totalDays + 1);
701
+ t.day = (Number(totalDays) + 1);
654
702
  }
655
703
  else
656
704
  {
657
705
  t.month = 2;
658
- t.day = (totalDays - 31 + 1);
706
+ t.day = (Number(totalDays) - 31 + 1);
659
707
  }
660
708
  }
661
709
  else
662
710
  if (totalDays < 90)
663
711
  {
664
712
  t.month = 3;
665
- t.day = (totalDays - 59 + 1);
713
+ t.day = (Number(totalDays) - 59 + 1);
666
714
  }
667
715
  else
668
716
  {
669
717
  t.month = 4;
670
- t.day = (totalDays - 90 + 1);
718
+ t.day = (Number(totalDays) - 90 + 1);
671
719
  }
672
720
  }
673
721
  else
@@ -679,24 +727,24 @@ export class DateTimeUtil
679
727
  if (totalDays < 151)
680
728
  {
681
729
  t.month = 5;
682
- t.day = (totalDays - 120 + 1);
730
+ t.day = (Number(totalDays) - 120 + 1);
683
731
  }
684
732
  else
685
733
  {
686
734
  t.month = 6;
687
- t.day = (totalDays - 151 + 1);
735
+ t.day = (Number(totalDays) - 151 + 1);
688
736
  }
689
737
  }
690
738
  else
691
739
  if (totalDays < 212)
692
740
  {
693
741
  t.month = 7;
694
- t.day = (totalDays - 181 + 1);
742
+ t.day = (Number(totalDays) - 181 + 1);
695
743
  }
696
744
  else
697
745
  {
698
746
  t.month = 8;
699
- t.day = (totalDays - 212 + 1);
747
+ t.day = (Number(totalDays) - 212 + 1);
700
748
  }
701
749
  }
702
750
  else
@@ -706,24 +754,24 @@ export class DateTimeUtil
706
754
  if (totalDays < 273)
707
755
  {
708
756
  t.month = 9;
709
- t.day = (totalDays - 243 + 1);
757
+ t.day = (Number(totalDays) - 243 + 1);
710
758
  }
711
759
  else
712
760
  {
713
761
  t.month = 10;
714
- t.day = (totalDays - 273 + 1);
762
+ t.day = (Number(totalDays) - 273 + 1);
715
763
  }
716
764
  }
717
765
  else
718
766
  if (totalDays < 334)
719
767
  {
720
768
  t.month = 11;
721
- t.day = (totalDays - 304 + 1);
769
+ t.day = (Number(totalDays) - 304 + 1);
722
770
  }
723
771
  else
724
772
  {
725
773
  t.month = 12;
726
- t.day = (totalDays - 334 + 1);
774
+ t.day = (Number(totalDays) - 334 + 1);
727
775
  }
728
776
  }
729
777
  }
@@ -734,22 +782,22 @@ export class DateTimeUtil
734
782
  {
735
783
  if (tzQhr == null)
736
784
  tzQhr = DateTimeUtil.getLocalTzQhr();
737
- secs = secs + tzQhr * 900;
738
- let totalDays = Math.floor(secs / 86400);
785
+ secs = BigInt(secs) + BigInt(tzQhr * 900);
786
+ let totalDays = secs / 86400n;
739
787
  let minutes;
740
788
  if (secs < 0)
741
789
  {
742
- secs -= totalDays * 86400;
790
+ secs -= totalDays * 86400n;
743
791
  while (secs < 0)
744
792
  {
745
793
  totalDays -= 1;
746
- secs += 86400;
794
+ secs += 86400n;
747
795
  }
748
- minutes = (secs % 86400);
796
+ minutes = Number(secs % 86400n);
749
797
  }
750
798
  else
751
799
  {
752
- minutes = (secs % 86400);
800
+ minutes = Number(secs % 86400n);
753
801
  }
754
802
 
755
803
  let t = new TimeValue();
@@ -1494,7 +1542,7 @@ export class Duration
1494
1542
  {
1495
1543
  constructor(seconds, nanosec)
1496
1544
  {
1497
- this.seconds = seconds;
1545
+ this.seconds = BigInt(seconds);
1498
1546
  this.nanosec = nanosec;
1499
1547
  }
1500
1548
 
@@ -1502,8 +1550,8 @@ export class Duration
1502
1550
  {
1503
1551
  if (ticks < 0)
1504
1552
  {
1505
- let ns = ticks % 1000;
1506
- let seconds = Math.floor(ticks / 1000);
1553
+ let ns = Number(BigInt(ticks) % 1000n);
1554
+ let seconds = BigInt(ticks) / 1000n;
1507
1555
  if (ns != 0)
1508
1556
  {
1509
1557
  ns = (-ns) * 1000000;
@@ -1513,7 +1561,7 @@ export class Duration
1513
1561
  }
1514
1562
  else
1515
1563
  {
1516
- return new Duration(Math.floor(ticks / 1000), (ticks % 1000) * 1000000);
1564
+ return new Duration(BigInt(ticks) / 1000n, Number(BigInt(ticks) % 1000n) * 1000000);
1517
1565
  }
1518
1566
  }
1519
1567
 
@@ -1521,16 +1569,16 @@ export class Duration
1521
1569
  {
1522
1570
  if (us < 0)
1523
1571
  {
1524
- let ns = us % 1000000;
1525
- let seconds = Math.floor(us / 1000000);
1526
- if (ns != 0)
1572
+ let ns = Number(BigInt(us) % 1000000n);
1573
+ let seconds = BigInt(us) / 1000000n;
1574
+ if (ns == 0)
1527
1575
  return new Duration(seconds, 0);
1528
1576
  else
1529
- return new Duration(seconds - 1, (-ns) * 1000);
1577
+ return new Duration(seconds - 1n, (-ns) * 1000);
1530
1578
  }
1531
1579
  else
1532
1580
  {
1533
- return new Duration(Math.floor(us / 1000000), (us % 1000000) * 1000);
1581
+ return new Duration(BigInt(us) / 1000000n, Number(BigInt(us) % 1000000n) * 1000);
1534
1582
  }
1535
1583
  }
1536
1584
 
@@ -1546,12 +1594,12 @@ export class Duration
1546
1594
 
1547
1595
  getTotalMS()
1548
1596
  {
1549
- return this.seconds * 1000 + Math.floor(this.ns / 1000000);
1597
+ return Number(this.seconds) * 1000 + this.ns / 1000000n;
1550
1598
  }
1551
1599
 
1552
1600
  getTotalSec()
1553
1601
  {
1554
- return this.seconds + (this.ns * 0.000000001);
1602
+ return Number(this.seconds) + (this.ns * 0.000000001);
1555
1603
  }
1556
1604
 
1557
1605
  notZero()
@@ -1574,7 +1622,7 @@ export class Duration
1574
1622
  txt.push('-');
1575
1623
  if (ns > 0)
1576
1624
  {
1577
- secs = -secs - 1;
1625
+ secs = -secs - 1n;
1578
1626
  ns = 1000000000 - ns;
1579
1627
  }
1580
1628
  else
@@ -1582,21 +1630,21 @@ export class Duration
1582
1630
  secs = -secs;
1583
1631
  }
1584
1632
  }
1585
- txt.push(Math.floor(secs / 3600));
1586
- secs = secs % 3600;
1633
+ txt.push((secs / 3600n).toString());
1634
+ secs = secs % 3600n;
1587
1635
  txt.push(':');
1588
1636
  if (secs < 600)
1589
1637
  {
1590
1638
  txt.push('0');
1591
1639
  }
1592
- txt.push(Math.floor(secs / 60));
1593
- secs = secs % 60;
1640
+ txt.push((secs / 60n).toString());
1641
+ secs = secs % 60n;
1594
1642
  txt.push(':');
1595
1643
  if (secs < 10)
1596
1644
  {
1597
1645
  txt.push('0');
1598
1646
  }
1599
- txt.push(secs);
1647
+ txt.push(secs.toString());
1600
1648
  if (ns != 0)
1601
1649
  {
1602
1650
  txt.push('.');
@@ -1736,13 +1784,29 @@ export class LocalDate
1736
1784
  {
1737
1785
  return this.dateVal == LocalDate.DATE_NULL;
1738
1786
  }
1787
+
1788
+ static today()
1789
+ {
1790
+ let d = new Date();
1791
+ return new LocalDate(d.getFullYear(), d.getMonth() + 1, d.getDate());
1792
+ }
1793
+
1794
+ static fromStr(s)
1795
+ {
1796
+ let timeVal = DateTimeUtil.string2TimeValue(s, 0);
1797
+ if (timeVal)
1798
+ {
1799
+ return new LocalDate(timeVal.year, timeVal.month, timeVal.day);
1800
+ }
1801
+ return null;
1802
+ }
1739
1803
  }
1740
1804
 
1741
1805
  export class TimeInstant
1742
1806
  {
1743
1807
  constructor(sec, nanosec)
1744
1808
  {
1745
- this.sec = sec;
1809
+ this.sec = BigInt(sec)
1746
1810
  this.nanosec = nanosec;
1747
1811
  }
1748
1812
 
@@ -1769,7 +1833,7 @@ export class TimeInstant
1769
1833
  let days = Math.floor(variTime);
1770
1834
  let ds = (variTime - days);
1771
1835
  let s = Math.floor(ds * 86400);
1772
- return new TimeInstant((days - 25569) * 86400000 + Math.floor(ds * 86400000), ((ds * 86400 - s) * 1000000000));
1836
+ return new TimeInstant((days - 25569n) * 86400000n + Math.floor(ds * 86400000n), ((ds * 86400n - s) * 1000000000n));
1773
1837
  }
1774
1838
 
1775
1839
  static fromTicks(ticks)
@@ -1787,17 +1851,17 @@ export class TimeInstant
1787
1851
 
1788
1852
  addDay(val)
1789
1853
  {
1790
- return new TimeInstant(this.sec + val * 86400, this.nanosec);
1854
+ return new TimeInstant(this.sec + val * 86400n, this.nanosec);
1791
1855
  }
1792
1856
 
1793
1857
  addHour(val)
1794
1858
  {
1795
- return new TimeInstant(this.sec + val * 3600, this.nanosec);
1859
+ return new TimeInstant(this.sec + val * 3600n, this.nanosec);
1796
1860
  }
1797
1861
 
1798
1862
  addMinute(val)
1799
1863
  {
1800
- return new TimeInstant(this.sec + val * 60, this.nanosec);
1864
+ return new TimeInstant(this.sec + val * 60n, this.nanosec);
1801
1865
  }
1802
1866
 
1803
1867
  addSecond(val)
@@ -1853,22 +1917,22 @@ export class TimeInstant
1853
1917
 
1854
1918
  getMSPassedDate()
1855
1919
  {
1856
- return (this.sec % 86400) * 1000 + Math.floor(this.nanosec / 1000000);
1920
+ return Number(this.sec % 86400) * 1000 + Math.floor(this.nanosec / 1000000);
1857
1921
  }
1858
1922
 
1859
1923
  diffMS(ts)
1860
1924
  {
1861
- return (this.sec - ts.sec) * 1000 + Math.floor((this.nanosec / 1000000) - (ts.nanosec / 1000000));
1925
+ return Number(this.sec - ts.sec) * 1000 + Math.floor((this.nanosec / 1000000) - (ts.nanosec / 1000000));
1862
1926
  }
1863
1927
 
1864
1928
  diffSec(ts)
1865
1929
  {
1866
- return this.sec - ts.sec;
1930
+ return Number(this.sec - ts.sec);
1867
1931
  }
1868
1932
 
1869
1933
  diffSecDbl(ts)
1870
1934
  {
1871
- return (this.sec - ts.sec) + (this.nanosec - ts.nanosec) / 1000000000.0;
1935
+ return Number(this.sec - ts.sec) + (this.nanosec - ts.nanosec) / 1000000000.0;
1872
1936
  }
1873
1937
 
1874
1938
  diff(ts)
@@ -1879,22 +1943,22 @@ export class TimeInstant
1879
1943
  if (ns1 >= ns2)
1880
1944
  return new Duration(secs, ns1 - ns2);
1881
1945
  else
1882
- return new Duration(secs - 1, 1000000000 + ns1 - ns2);
1946
+ return new Duration(secs - 1n, 1000000000 + ns1 - ns2);
1883
1947
  }
1884
1948
 
1885
1949
  toTicks()
1886
1950
  {
1887
- return this.sec * 1000 + Math.floor(this.nanosec / 1000000);
1951
+ return Number(this.sec) * 1000 + Math.floor(this.nanosec / 1000000);
1888
1952
  }
1889
1953
 
1890
1954
  toDotNetTicks()
1891
1955
  {
1892
- return this.sec * 10000000 + 621355968000000000 + Math.floor(this.nanosec / 100);
1956
+ return this.sec * 10000000n + 621355968000000000n + BigInt(Math.floor(this.nanosec / 100));
1893
1957
  }
1894
1958
 
1895
1959
  toUnixTimestamp()
1896
1960
  {
1897
- return this.sec;
1961
+ return Number(this.sec);
1898
1962
  }
1899
1963
 
1900
1964
  toEpochSec()
@@ -1904,12 +1968,12 @@ export class TimeInstant
1904
1968
 
1905
1969
  toEpochMS()
1906
1970
  {
1907
- return this.sec * 1000 + Math.floor(this.nanosec / 1000000);
1971
+ return this.sec * 1000 + BigInt(Math.floor(this.nanosec / 1000000));
1908
1972
  }
1909
1973
 
1910
1974
  toEpochNS()
1911
1975
  {
1912
- return this.sec * 1000000000 + this.nanosec;
1976
+ return this.sec * 1000000000 + BigInt(this.nanosec);
1913
1977
  }
1914
1978
  }
1915
1979
 
@@ -1931,9 +1995,9 @@ export class Timestamp
1931
1995
  static fromStr(str, defTzQhr)
1932
1996
  {
1933
1997
  let tval = DateTimeUtil.string2TimeValue(str, defTzQhr);
1934
- if (tval == 0)
1998
+ if (tval == null)
1935
1999
  {
1936
- return new Timestamp(new TimeInstant(0, 0), defTzQhr);
2000
+ return null;
1937
2001
  }
1938
2002
  else
1939
2003
  {
@@ -1980,11 +2044,11 @@ export class Timestamp
1980
2044
  {
1981
2045
  if (epochUS < 0)
1982
2046
  {
1983
- return new Timestamp(new TimeInstant(Math.floor(epochUS / 1000000) - 1, (epochUS % 1000000 + 1000000) * 1000), tzQhr);
2047
+ return new Timestamp(new TimeInstant(epochUS / 1000000n - 1, Number(epochUS % 1000000 + 1000000) * 1000), tzQhr);
1984
2048
  }
1985
2049
  else
1986
2050
  {
1987
- return new Timestamp(new TimeInstant(Math.floor(epochUS / 1000000), (epochUS % 1000000) * 1000), tzQhr);
2051
+ return new Timestamp(new TimeInstant(epochUS / 1000000n, Number(epochUS % 1000000) * 1000), tzQhr);
1988
2052
  }
1989
2053
  }
1990
2054
 
@@ -1992,11 +2056,11 @@ export class Timestamp
1992
2056
  {
1993
2057
  if (epochNS < 0)
1994
2058
  {
1995
- return new Timestamp(new TimeInstant(Math.floor(epochNS / 1000000000) - 1, (epochNS % 1000000000 + 1000000000)), tzQhr);
2059
+ return new Timestamp(new TimeInstant(epochNS / 1000000000n - 1, Number(epochNS % 1000000000 + 1000000000)), tzQhr);
1996
2060
  }
1997
2061
  else
1998
2062
  {
1999
- return new Timestamp(new TimeInstant(Math.floor(epochNS / 1000000000), (epochNS % 1000000000)), tzQhr);
2063
+ return new Timestamp(new TimeInstant(epochNS / 1000000000n, Number(epochNS % 1000000000)), tzQhr);
2000
2064
  }
2001
2065
  }
2002
2066
 
@@ -2222,7 +2286,7 @@ export class Timestamp
2222
2286
  {
2223
2287
  if (this.inst.nanosec == 0)
2224
2288
  {
2225
- if (((this.inst.sec + this.tzQhr * 900) % 86400) == 0)
2289
+ if (((this.inst.sec + BigInt(this.tzQhr * 900)) % 86400n) == 0)
2226
2290
  {
2227
2291
  return this.toString("yyyy-MM-dd");
2228
2292
  }
@@ -2314,6 +2378,11 @@ export class ByteReader
2314
2378
  return this.view.buffer.slice(this.view.byteOffset + ofst, this.view.byteOffset + ofst + size);
2315
2379
  }
2316
2380
 
2381
+ getU8Arr(ofst, size)
2382
+ {
2383
+ return new Uint8Array(this.getArrayBuffer(ofst, size));
2384
+ }
2385
+
2317
2386
  readUInt8(ofst)
2318
2387
  {
2319
2388
  return this.view.getUint8(ofst);
@@ -2324,6 +2393,14 @@ export class ByteReader
2324
2393
  return this.view.getUint16(ofst, lsb);
2325
2394
  }
2326
2395
 
2396
+ readUInt24(ofst, lsb)
2397
+ {
2398
+ if (lsb)
2399
+ return this.view.getUint8(ofst) + (this.view.getUint16(ofst + 1, true) << 8);
2400
+ else
2401
+ return (this.view.getUint16(ofst, false) << 8) | this.view.getUint8(ofst + 2);
2402
+ }
2403
+
2327
2404
  readUInt32(ofst, lsb)
2328
2405
  {
2329
2406
  return this.view.getUint32(ofst, lsb);
@@ -2339,6 +2416,14 @@ export class ByteReader
2339
2416
  return this.view.getInt16(ofst, lsb);
2340
2417
  }
2341
2418
 
2419
+ readInt24(ofst, lsb)
2420
+ {
2421
+ if (lsb)
2422
+ return this.view.getUint8(ofst) + (this.view.getInt16(ofst + 1, true) << 8);
2423
+ else
2424
+ return (this.view.getInt16(ofst, false) << 8) | this.view.getUint8(ofst + 2);
2425
+ }
2426
+
2342
2427
  readInt32(ofst, lsb)
2343
2428
  {
2344
2429
  return this.view.getInt32(ofst, lsb);
@@ -2375,6 +2460,17 @@ export class ByteReader
2375
2460
  return dec.decode(this.view.buffer.slice(this.view.byteOffset + ofst, this.view.byteOffset + end));
2376
2461
  }
2377
2462
 
2463
+ readUTF16(ofst, nChar, lsb)
2464
+ {
2465
+ let ret = [];
2466
+ while (nChar-- > 0)
2467
+ {
2468
+ ret.push(String.fromCharCode(this.readUInt16(ofst, lsb)));
2469
+ ofst += 2;
2470
+ }
2471
+ return ret.join("");
2472
+ }
2473
+
2378
2474
  readUInt8Arr(ofst, cnt)
2379
2475
  {
2380
2476
  let ret = [];
@@ -2451,4 +2547,31 @@ export class ByteReader
2451
2547
  }
2452
2548
  return ret;
2453
2549
  }
2550
+
2551
+ isASCIIText(ofst, len)
2552
+ {
2553
+ while (len-- > 0)
2554
+ {
2555
+ let b = this.readUInt8(ofst);
2556
+ if ((b >= 0x20 && b < 0x7F) || b == 13 || b == 10)
2557
+ {
2558
+
2559
+ }
2560
+ else
2561
+ {
2562
+ return false;
2563
+ }
2564
+ ofst++;
2565
+ }
2566
+ return true;
2567
+ }
2568
+ }
2569
+
2570
+ export class ParsedObject
2571
+ {
2572
+ constructor(sourceName, objType)
2573
+ {
2574
+ this.sourceName = sourceName;
2575
+ this.objType = objType;
2576
+ }
2454
2577
  }
package/geometry.d.ts CHANGED
@@ -5,7 +5,7 @@ declare class BoundaryPointResult
5
5
  x: number;
6
6
  y: number;
7
7
  dist: number;
8
- };
8
+ }
9
9
 
10
10
  export enum VectorType
11
11
  {
@@ -41,7 +41,7 @@ export class Vector2D {
41
41
  constructor(srid: number);
42
42
  insideOrTouch(coord: math.Coord2D): boolean;
43
43
  getBounds(): math.RectArea;
44
- };
44
+ }
45
45
 
46
46
  export class Point extends Vector2D
47
47
  {