2525 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2626 */
2727
28- import { copyBytes } from "./deps.ts" ;
28+ import { copy } from "./deps.ts" ;
2929
3030export class PacketWriter {
3131 private size : number ;
@@ -49,7 +49,7 @@ export class PacketWriter {
4949 // https://stackoverflow.com/questions/2269063/buffer-growth-strategy
5050 const newSize = oldBuffer . length + ( oldBuffer . length >> 1 ) + size ;
5151 this . buffer = new Uint8Array ( newSize ) ;
52- copyBytes ( oldBuffer , this . buffer ) ;
52+ copy ( oldBuffer , this . buffer ) ;
5353 }
5454 }
5555
@@ -76,7 +76,7 @@ export class PacketWriter {
7676 } else {
7777 const encodedStr = this . encoder . encode ( string ) ;
7878 this . _ensure ( encodedStr . byteLength + 1 ) ; // +1 for null terminator
79- copyBytes ( encodedStr , this . buffer , this . offset ) ;
79+ copy ( encodedStr , this . buffer , this . offset ) ;
8080 this . offset += encodedStr . byteLength ;
8181 }
8282
@@ -90,7 +90,7 @@ export class PacketWriter {
9090 }
9191
9292 this . _ensure ( 1 ) ;
93- copyBytes ( this . encoder . encode ( c ) , this . buffer , this . offset ) ;
93+ copy ( this . encoder . encode ( c ) , this . buffer , this . offset ) ;
9494 this . offset ++ ;
9595 return this ;
9696 }
@@ -99,14 +99,14 @@ export class PacketWriter {
9999 string = string || "" ;
100100 const encodedStr = this . encoder . encode ( string ) ;
101101 this . _ensure ( encodedStr . byteLength ) ;
102- copyBytes ( encodedStr , this . buffer , this . offset ) ;
102+ copy ( encodedStr , this . buffer , this . offset ) ;
103103 this . offset += encodedStr . byteLength ;
104104 return this ;
105105 }
106106
107107 add ( otherBuffer : Uint8Array ) {
108108 this . _ensure ( otherBuffer . length ) ;
109- copyBytes ( otherBuffer , this . buffer , this . offset ) ;
109+ copy ( otherBuffer , this . buffer , this . offset ) ;
110110 this . offset += otherBuffer . length ;
111111 return this ;
112112 }
0 commit comments