1use std::io::{BufReader, Read};
2
3use crate::traits::FileParser;
4
5#[derive(Debug)]
6pub struct Kdump<'a> {
7 file: &'a str,
8}
9
10impl<'c> FileParser for Kdump<'c> {
11 fn get_file_path(&self) -> &str {
12 self.file
13 }
14
15 fn print(&self) {
16 let file = self.open();
17 let buf_reader = BufReader::new(file);
18
19 for (_i, byte) in buf_reader.bytes().enumerate() {
20 if let Ok(data) = byte {
21 print!("{:02X}", data);
22 }
23 }
24 }
25
26 fn write_to_file(&self) {
27 todo!()
28 }
29}
30
31impl<'b> Kdump<'b> {
32 pub(crate) fn new(file: &'b str) -> Self {
33 Self { file }
34 }
35}