Closed stcarrez closed 1 year ago
Some files are composed of mime multi-part sections as described in the RFC 1341. Each multi-part section is separated by boundaries.
We can take the advantages of the stream composing framework available in Ada Utility Library to allow reading such multi-part files.
We could use such new Input_Part_Stream type as follows:
Input_Part_Stream
SEP : constant String := "" & ASCII.LF; File : aliased Util.Streams.Files.File_Stream; Parts : Util.Streams.Buffered.Parts.Input_Part_Stream; Head, Msg, sign : Ada.Strings.Unbounded.Unbounded_String; File.Open (Ada.Streams.Stream_IO.In_File, Path); Parts.Initialize (Input => File'Unchecked_Access, Size => 4096); Parts.Set_Boundary (SEP & "-----BEGIN PGP SIGNED MESSAGE-----" & SEP); Parts.Read (Head); Parts.Set_Boundary (SEP & "-----BEGIN PGP SIGNATURE-----" & SEP); Parts.Read (Msg); Parts.Set_Boundary (SEP & "-----END PGP SIGNATURE-----" & SEP); Parts.Read (Sign);
Some files are composed of mime multi-part sections as described in the RFC 1341. Each multi-part section is separated by boundaries.
We can take the advantages of the stream composing framework available in Ada Utility Library to allow reading such multi-part files.
We could use such new
Input_Part_Stream
type as follows: