using skyscraper5.Skyscraper.IO;

namespace skyscraper8.GSE;

public class BbframeDumper : IBbframeDeencapsulator, IDisposable
{
    public BbframeDumper(FileInfo file)
    {
        file.Directory.EnsureExists();
        ourStream = file.OpenWrite();
    }

    private FileStream ourStream;
    
    public void PushPacket(byte[] bbframe)
    {
        ourStream.Write(bbframe, 0, bbframe.Length);
    }

    public void Dispose()
    {
        ourStream.Flush();
        ourStream.Close();
        ourStream.Dispose();
    }
}