Example #1
0
def createCompressionContext():
    ctx = ffi.new("LZ4F_compressionContext_t*")
    r = lib.LZ4F_createCompressionContext(ctx, lib.LZ4F_VERSION)
    if lib.LZ4F_isError(r):
        raise NameError(ffi.string(lib.LZ4F_getErrorName(code)))
    else:
        return ctx
Example #2
0
def createCompressionContext():
    ctx = ffi.new("LZ4F_compressionContext_t*")
    r = lib.LZ4F_createCompressionContext(ctx, lib.LZ4F_VERSION)
    if lib.LZ4F_isError(r):
        raise NameError(ffi.string(lib.LZ4F_getErrorName(code)))
    else:
        return ctx
Example #3
0
def compressUpdate(ctx,
                   dst_buf,
                   dst_size,
                   src_buf,
                   src_size,
                   comp_opts=ffi.NULL):
    n = lib.LZ4F_compressUpdate(ctx, dst_buf, dst_size, src_buf, src_size,
                                comp_opts)
    if lib.LZ4F_isError(n):
        raise NameError(ffi.string(lib.LZ4F_getErrorName(n)))
    else:
        return n
Example #4
0
def compressEnd(ctx, dst_buf, dst_size, comp_opts = ffi.NULL):
    n = lib.LZ4F_compressEnd(ctx, dst_buf, dst_size, comp_opts)
    if lib.LZ4F_isError(n):
         raise NameError(ffi.string(lib.LZ4F_getErrorName(n)))
    else:
        return n
Example #5
0
def compressBegin(ctx, dst_buf, dst_size, prefs=ffi.NULL):
    n = lib.LZ4F_compressBegin(ctx, dst_buf, dst_size, prefs)
    if lib.LZ4F_isError(n):
        raise NameError(ffi.string(lib.LZ4F_getErrorName(n)))
    else:
        return n