mirror of https://github.com/google/brotli
Update wrappers (#564)
* golang: add build information via `cgo.go` * golang: fix lgwin parameter behavior * Java: add proguard configuration
This commit is contained in:
parent
00cacfdff6
commit
a4d2956ded
|
@ -0,0 +1,13 @@
|
|||
// Copyright 2017 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Distributed under MIT license.
|
||||
// See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
|
||||
|
||||
package cbrotli
|
||||
|
||||
// Inform golang build system that it should link brotli libraries.
|
||||
|
||||
// #cgo LDFLAGS: -lbrotlicommon
|
||||
// #cgo LDFLAGS: -lbrotlidec
|
||||
// #cgo LDFLAGS: -lbrotlienc
|
||||
import "C"
|
|
@ -56,9 +56,6 @@ type WriterOptions struct {
|
|||
// LGWin is the base 2 logarithm of the sliding window size.
|
||||
// Range is 10 to 24. 0 indicates automatic configuration based on Quality.
|
||||
LGWin int
|
||||
// BufferSize is the number of bytes to use to buffer encoded output.
|
||||
// 0 indicates an implementation-defined default.
|
||||
BufferSize int
|
||||
}
|
||||
|
||||
// Writer implements io.WriteCloser by writing Brotli-encoded data to an
|
||||
|
@ -80,8 +77,10 @@ func NewWriter(dst io.Writer, options WriterOptions) *Writer {
|
|||
state := C.BrotliEncoderCreateInstance(nil, nil, nil)
|
||||
C.BrotliEncoderSetParameter(
|
||||
state, C.BROTLI_PARAM_QUALITY, (C.uint32_t)(options.Quality))
|
||||
C.BrotliEncoderSetParameter(
|
||||
state, C.BROTLI_PARAM_LGWIN, (C.uint32_t)(options.LGWin))
|
||||
if options.LGWin > 0 {
|
||||
C.BrotliEncoderSetParameter(
|
||||
state, C.BROTLI_PARAM_LGWIN, (C.uint32_t)(options.LGWin))
|
||||
}
|
||||
return &Writer{
|
||||
dst: dst,
|
||||
state: state,
|
||||
|
|
|
@ -11,6 +11,7 @@ java_library(
|
|||
["*.java"],
|
||||
exclude = ["*Test*.java"],
|
||||
),
|
||||
proguard_specs = ["proguard.cfg"],
|
||||
)
|
||||
|
||||
java_library(
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
# DictionaryData is an optionally / dynamically loaded built-in dictionary.
|
||||
-keep class org.brotli.dec.DictionaryData
|
Loading…
Reference in New Issue