File tree Expand file tree Collapse file tree 4 files changed +55
-18
lines changed
okhttp-brotli/src/main/kotlin/okhttp3/brotli
okhttp/src/commonJvmAndroid/kotlin/okhttp3 Expand file tree Collapse file tree 4 files changed +55
-18
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (C) 2019 Square, Inc.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+ package okhttp3.brotli
17+
18+ import okhttp3.CompressionInterceptor
19+ import okio.BufferedSource
20+ import okio.Source
21+ import okio.source
22+ import org.brotli.dec.BrotliInputStream
23+
24+ object Brotli : CompressionInterceptor.DecompressionAlgorithm {
25+ override val encoding: String get() = " br"
26+
27+ override fun decompress (compressedSource : BufferedSource ): Source = BrotliInputStream (compressedSource.inputStream()).source()
28+ }
Original file line number Diff line number Diff line change @@ -17,10 +17,6 @@ package okhttp3.brotli
1717
1818import okhttp3.CompressionInterceptor
1919import okhttp3.Gzip
20- import okio.BufferedSource
21- import okio.Source
22- import okio.source
23- import org.brotli.dec.BrotliInputStream
2420
2521/* *
2622 * Transparent Brotli response support.
@@ -29,9 +25,3 @@ import org.brotli.dec.BrotliInputStream
2925 * responses. n.b. this replaces the transparent gzip compression in BridgeInterceptor.
3026 */
3127object BrotliInterceptor : CompressionInterceptor(Brotli , Gzip )
32-
33- object Brotli : CompressionInterceptor.DecompressionAlgorithm {
34- override val encoding: String get() = " br"
35-
36- override fun decompress (compressedSource : BufferedSource ): Source = BrotliInputStream (compressedSource.inputStream()).source()
37- }
Original file line number Diff line number Diff line change 1515 */
1616package okhttp3
1717
18- import okhttp3.CompressionInterceptor.DecompressionAlgorithm
1918import okhttp3.ResponseBody.Companion.asResponseBody
2019import okhttp3.internal.http.promisesBody
2120import okio.BufferedSource
22- import okio.GzipSource
2321import okio.Source
2422import okio.buffer
2523
@@ -95,9 +93,3 @@ open class CompressionInterceptor(
9593 fun decompress (compressedSource : BufferedSource ): Source
9694 }
9795}
98-
99- object Gzip : DecompressionAlgorithm {
100- override val encoding: String get() = " gzip"
101-
102- override fun decompress (compressedSource : BufferedSource ): Source = GzipSource (compressedSource)
103- }
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2025 Block, Inc.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+ package okhttp3
17+
18+ import okhttp3.CompressionInterceptor.DecompressionAlgorithm
19+ import okio.BufferedSource
20+ import okio.GzipSource
21+ import okio.Source
22+
23+ object Gzip : DecompressionAlgorithm {
24+ override val encoding: String get() = " gzip"
25+
26+ override fun decompress (compressedSource : BufferedSource ): Source = GzipSource (compressedSource)
27+ }
You can’t perform that action at this time.
0 commit comments