[−][src]Function vtkio::parse_legacy_be
pub fn parse_legacy_be(reader: impl Read) -> Result<Vtk, Error>
Parse a legacy VTK file from the given reader.
If the file is in binary format, numeric types will be interpreted in big endian format.
Note that this function and parse_legacy_le
also work equally well for
parsing VTK files in ASCII format.
Examples
Parsing an ASCII file:
use vtkio::model::*; // import model definition of a VTK file let vtk_ascii: &[u8] = b" # vtk DataFile Version 2.0 Triangle example ASCII DATASET POLYDATA POINTS 3 float 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 -1.0 POLYGONS 1 4 3 0 1 2 "; let vtk = vtkio::parse_legacy_be(vtk_ascii).expect("Failed to parse vtk file"); assert_eq!(vtk, Vtk { version: Version::new((2,0)), byte_order: ByteOrder::BigEndian, // This is default title: String::from("Triangle example"), data: DataSet::inline(PolyDataPiece { points: vec![0.0f32, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, -1.0].into(), polys: Some(VertexNumbers::Legacy { num_cells: 1, vertices: vec![3, 0, 1, 2] }), data: Attributes::new(), ..Default::default() }) });