# Path: dtformats/data_format.py
# class BinaryDataFormat(object):
# class BinaryDataFile(BinaryDataFormat):
#   _FABRIC = None
#   _DEFINITION_FILES_PATH = os.path.dirname(__file__)
#   _HEXDUMP_CHARACTER_MAP = [
#       '.' if byte < 0x20 or byte > 0x7e else chr(byte) for byte in range(256)]
#   def __init__(self, debug=False, output_writer=None):
#   def _DebugPrintData(self, description, data):
#   def _DebugPrintDecimalValue(self, description, value):
#   def _DebugPrintFiletimeValue(self, description, value):
#   def _DebugPrintStructureObject(self, structure_object, debug_info):
#   def _DebugPrintPosixTimeValue(self, description, value):
#   def _DebugPrintText(self, text):
#   def _DebugPrintValue(self, description, value):
#   def _FormatDataInHexadecimal(self, data):
#   def _FormatArrayOfIntegersAsDecimals(self, array_of_integers):
#   def _FormatArrayOfIntegersAsOffsets(self, array_of_integers):
#   def _FormatArrayOfIntegersAsIPv4Address(self, array_of_integers):
#   def _FormatArrayOfIntegersAsIPv6Address(self, array_of_integers):
#   def _FormatFloatingPoint(self, floating_point):
#   def _FormatIntegerAsDecimal(self, integer):
#   def _FormatIntegerAsFiletime(self, integer):
#   def _FormatIntegerAsHexadecimal2(self, integer):
#   def _FormatIntegerAsHexadecimal4(self, integer):
#   def _FormatIntegerAsHexadecimal8(self, integer):
#   def _FormatIntegerAsPosixTime(self, integer):
#   def _FormatIntegerAsPosixTimeInMicroseconds(self, integer):
#   def _FormatIntegerAsOffset(self, integer):
#   def _FormatPackedIPv4Address(self, packed_ip_address):
#   def _FormatPackedIPv6Address(self, packed_ip_address):
#   def _FormatString(self, string):
#   def _FormatStructureObject(self, structure_object, debug_info):
#   def _FormatUUIDAsString(self, uuid):
#   def _FormatValue(self, description, value):
#   def _GetDataTypeMap(self, name):
#   def _ReadData(self, file_object, file_offset, data_size, description):
#   def _ReadStructure(
#       self, file_object, file_offset, data_size, data_type_map, description):
#   def _ReadStructureFromByteStream(
#       self, byte_stream, file_offset, data_type_map, description, context=None):
#   def _ReadStructureFromFileObject(
#       self, file_object, file_offset, data_type_map, description):
#   def ReadDefinitionFile(cls, filename):
#   def __init__(self, debug=False, output_writer=None):
#   def Close(self):
#   def Open(self, path):
#   def ReadFileObject(self, file_object):
# 
# Path: dtformats/errors.py
# class ParseError(Exception):


import zlib
import lz4.block
from dfdatetime import cocoa_time as dfdatetime_cocoa_time
from dfdatetime import posix_time as dfdatetime_posix_time
from dtfabric import errors as dtfabric_errors
from dtfabric.runtime import data_maps as dtfabric_data_maps
from dtformats import data_format
from dtformats import errors
    if value == 0:
      date_time_string = 'Not set (0)'
    else:
      date_time = dfdatetime_posix_time.PosixTimeInMicroseconds(timestamp=value)
      date_time_string = date_time.CopyToDateTimeString()
      if date_time_string:
        date_time_string = '{0:s} UTC'.format(date_time_string)
      else:
        date_time_string = '0x{0:08x}'.format(value)

    self._DebugPrintValue(description, date_time_string)

  def _DecompressLZ4PageData(self, compressed_page_data, file_offset):
    """Decompresses LZ4 compressed page data.

    Args:
      compressed_page_data (bytes): LZ4 compressed page data.
      file_offset (int): file offset.

    Returns:
      bytes: uncompressed page data.

    Raises:
      ParseError: if the page data cannot be decompressed.
    """
    data_type_map = self._GetDataTypeMap('spotlight_store_db_lz4_block_header')

    try:
      lz4_block_header = data_type_map.MapByteStream(compressed_page_data)
    except dtfabric_errors.MappingError as exception:

# Path: dtformats/data_format.py
# class BinaryDataFormat(object):
# class BinaryDataFile(BinaryDataFormat):
#   _FABRIC = None
#   _DEFINITION_FILES_PATH = os.path.dirname(__file__)
#   _HEXDUMP_CHARACTER_MAP = [
#       '.' if byte < 0x20 or byte > 0x7e else chr(byte) for byte in range(256)]
#   def __init__(self, debug=False, output_writer=None):
#   def _DebugPrintData(self, description, data):
#   def _DebugPrintDecimalValue(self, description, value):
#   def _DebugPrintFiletimeValue(self, description, value):
#   def _DebugPrintStructureObject(self, structure_object, debug_info):
#   def _DebugPrintPosixTimeValue(self, description, value):
#   def _DebugPrintText(self, text):
#   def _DebugPrintValue(self, description, value):
#   def _FormatDataInHexadecimal(self, data):
#   def _FormatArrayOfIntegersAsDecimals(self, array_of_integers):
#   def _FormatArrayOfIntegersAsOffsets(self, array_of_integers):
#   def _FormatArrayOfIntegersAsIPv4Address(self, array_of_integers):
#   def _FormatArrayOfIntegersAsIPv6Address(self, array_of_integers):
#   def _FormatFloatingPoint(self, floating_point):
#   def _FormatIntegerAsDecimal(self, integer):
#   def _FormatIntegerAsFiletime(self, integer):
#   def _FormatIntegerAsHexadecimal2(self, integer):
#   def _FormatIntegerAsHexadecimal4(self, integer):
#   def _FormatIntegerAsHexadecimal8(self, integer):
#   def _FormatIntegerAsPosixTime(self, integer):
#   def _FormatIntegerAsPosixTimeInMicroseconds(self, integer):
#   def _FormatIntegerAsOffset(self, integer):
#   def _FormatPackedIPv4Address(self, packed_ip_address):
#   def _FormatPackedIPv6Address(self, packed_ip_address):
#   def _FormatString(self, string):
#   def _FormatStructureObject(self, structure_object, debug_info):
#   def _FormatUUIDAsString(self, uuid):
#   def _FormatValue(self, description, value):
#   def _GetDataTypeMap(self, name):
#   def _ReadData(self, file_object, file_offset, data_size, description):
#   def _ReadStructure(
#       self, file_object, file_offset, data_size, data_type_map, description):
#   def _ReadStructureFromByteStream(
#       self, byte_stream, file_offset, data_type_map, description, context=None):
#   def _ReadStructureFromFileObject(
#       self, file_object, file_offset, data_type_map, description):
#   def ReadDefinitionFile(cls, filename):
#   def __init__(self, debug=False, output_writer=None):
#   def Close(self):
#   def Open(self, path):
#   def ReadFileObject(self, file_object):
# 
# Path: dtformats/errors.py
# class ParseError(Exception):


# Path: dtformats/spotlight_storedb.py
import zlib
import lz4.block
from dfdatetime import cocoa_time as dfdatetime_cocoa_time
from dfdatetime import posix_time as dfdatetime_posix_time
from dtfabric import errors as dtfabric_errors
from dtfabric.runtime import data_maps as dtfabric_data_maps
from dtformats import data_format
from dtformats import errors

    if value == 0:
      date_time_string = 'Not set (0)'
    else:
      date_time = dfdatetime_posix_time.PosixTimeInMicroseconds(timestamp=value)
      date_time_string = date_time.CopyToDateTimeString()
      if date_time_string:
        date_time_string = '{0:s} UTC'.format(date_time_string)
      else:
        date_time_string = '0x{0:08x}'.format(value)

    self._DebugPrintValue(description, date_time_string)

  def _DecompressLZ4PageData(self, compressed_page_data, file_offset):
    """Decompresses LZ4 compressed page data.

    Args:
      compressed_page_data (bytes): LZ4 compressed page data.
      file_offset (int): file offset.

    Returns:
      bytes: uncompressed page data.

    Raises:
      ParseError: if the page data cannot be decompressed.
    """
    data_type_map = self._GetDataTypeMap('spotlight_store_db_lz4_block_header')

    try:
      lz4_block_header = data_type_map.MapByteStream(compressed_page_data)
    except dtfabric_errors.MappingError as exception:

      raise errors.ParseError((