SAP CAR

The following subsections show a graphical representation of the file format portions and how to generate them.

First we need to perform some setup to import the packet classes:

In [1]:
from pysap.SAPCAR import *
from IPython.display import display

SAPCAR Archive version 2.00

We first create a temporary file and compress it inside an archive file:

In [2]:
with open("some_file", "w") as fd:
    fd.write("Some string to compress")

f0 = SAPCARArchive("archive_file.car", mode="wb", version=SAPCAR_VERSION_200)
f0.add_file("some_file")

The file is comprised of the following main structures:

SAPCAR Archive header

In [3]:
f0._sapcar.canvas_dump()
Out[3]:
../_images/fileformats_SAPCAR_7_0.png

SAPCAR Archive File header

In [4]:
f0._sapcar.files0[0].canvas_dump()
Out[4]:
../_images/fileformats_SAPCAR_9_0.png

SAPCAR Compressed block

In [5]:
f0._sapcar.files0[0].blocks[0].canvas_dump()
Out[5]:
../_images/fileformats_SAPCAR_11_0.png

SAPCAR compressed blob

In [6]:
f0._sapcar.files0[0].blocks[0].compressed.canvas_dump()
Out[6]:
../_images/fileformats_SAPCAR_13_0.png

SAPCAR Archive version 2.01

We first create a temporary file and compress it inside an archive file:

In [7]:
f1 = SAPCARArchive("archive_file.car", mode="wb", version=SAPCAR_VERSION_201)
f1.add_file("some_file")

The file is comprised of the following main structures:

SAPCAR Archive header

In [8]:
f1._sapcar.canvas_dump()
Out[8]:
../_images/fileformats_SAPCAR_18_0.png

SAPCAR Archive File header

In [9]:
f1._sapcar.files1[0].canvas_dump()
Out[9]:
../_images/fileformats_SAPCAR_20_0.png

SAPCAR Compressed block

In [10]:
f1._sapcar.files1[0].blocks[0].canvas_dump()
Out[10]:
../_images/fileformats_SAPCAR_22_0.png

SAPCAR compressed blob

In [11]:
f1._sapcar.files1[0].blocks[0].compressed.canvas_dump()
Out[11]:
../_images/fileformats_SAPCAR_24_0.png