develooper Front page | perl.perl6.users | Postings from February 2019

Re: Fastest way to convert from a Buf to a Str?

Thread Previous | Thread Next
From:
Darren Duncan
Date:
February 4, 2019 01:43
Subject:
Re: Fastest way to convert from a Buf to a Str?
Message ID:
5a0bfec6-84d0-d540-8e55-ef208dcfb19c@darrenduncan.net
On 2019-02-02 7:22 PM, ToddAndMargo via perl6-users wrote:
> I need to read a file into a buffer (NO CONVERSIONS!)
> and then convert it to a string (again with no
> conversions).

I think you're making an impossible request.  If preserving exact bytes is 
important, then you want to keep your data in a type that represents a sequence 
of bytes, such as Blob of Buf.  A Str represents a sequence of characters, which 
are NOT bytes, so if you're wanting to have a Str that is saying you don't care 
about the bytes.  Given what you keep saying, I'd say skip the Str and just use 
Buf or Blob etc full stop. -- Darren Duncan

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About