Questions tagged [okio]

Okio is a library that complements java.io and java.nio to make it easier to access, store, and process data.

Okio is a library that complements java.io and java.nio to make it easier to access, store, and process data. It is built around two types:

ByteString is an immutable sequence of bytes. For character data, String is fundamental.

ByteString is String's long-lost brother, making it easy to treat binary data as a value. This class is ergonomic: it knows how to encode and decode itself as hex, base64, and UTF-8.

Buffer is a mutable sequence of bytes. Like ArrayList, you don't need to size your buffer in advance. You read and write buffers as a queue: write data to the end and read it from the front. There's no obligation to manage positions, limits, or capacities.

Internally, ByteString and Buffer do some clever things to save CPU and memory. If you encode a UTF-8 string as a ByteString, it caches a reference to that string so that if you decode it later, there's no work to do.

Buffer is implemented as a linked list of segments. When you move data from one buffer to another, it reassigns ownership of the segments rather than copying the data across. This approach is particularly helpful for multithreaded programs: a thread that talks to the network can exchange data with a worker thread without any copying or ceremony.

84 questions
0
votes
1 answer

OKHTTP3 SocketTimeOut only on Specific Call

I have a mobile app that makes roughly 15 API calls to our REST API. Most of these are GET, POST, PUT and contain small to medium sized JSON body/response. We are using OKHTTP3 3.8.1 . We have one call that we make to API Gateway->Lambda that…
0
votes
1 answer

okhttp - execute() vs body().byteStream

When using OkHttp, the network request is executed in 1 or 2 in the following code: val response = client.newCall(request).execute() // (1) if (response.isSuccessful) { val bs = response.body().byteStream() //…
frankelot
  • 13,666
  • 16
  • 54
  • 89
0
votes
1 answer

Signed APK Proguard error Duplicate zip entry okio-1.6.0.jar:okio/AsyncTimeout$1.class

I know this question asked previously but i got an error for generating signed apk file after setting minifyEnabled=true Following is the message display in console Warning:Exception while processing task java.io.IOException: Can't write …
ganesh
  • 71
  • 1
  • 6
0
votes
0 answers

Wait for result from network call using retrofit and rxjava

I have an activity which contains 3 fragments which make a network call to fetch some data,for example user details.The calls made by the 3 fragments are independent of each other but are still pulling the same data. Suppose all 3 fragments request…
Jude Fernandes
  • 7,437
  • 11
  • 53
  • 90
0
votes
1 answer

Is okio 1.9.0 backward compatible with okio 1.2.0?

My project depends on a couple of third party libraries, which bring in okio v. 1.9.0 and 1.2.0, respectively. Can I count on backward compatibility, and just use okio version 1.9.0 (in place of 1.2.0)?
0
votes
1 answer

Android Studio Can't Fetch Library

I have recently started getting this issue with Android Studio and it has been driving me up the wall. I keep getting the error "Failed to resolve: com.squareup.okio:okio:1.8.0". These are the dependencies I have: dependencies { compile…
ethanzh
  • 133
  • 2
  • 5
  • 19
0
votes
0 answers

Fatal Exception: java.lang.NoClassDefFoundError okio.Okio

I have integrated paypal service in my application using try { //PayPal Intent intent = new Intent(VODActivity.this, PayPalService.class); intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, config); startService(intent); …
Naitik
  • 796
  • 11
  • 32
0
votes
2 answers

How to give deadline to okio via okHttp

From looking at okHttp source code, when call.execute() is called the body being transferred from server to the client. It doesn't make sense because it makes impossible to set deadline to okio which means i cannot give timeout to the whole request…
danidin
  • 371
  • 2
  • 17
0
votes
1 answer

Parameters not being sent using OkHTTP for Android Studio

So, I'm using Android Studio 1.2.1.1, oKhttp 2.5.0, okio 1.6.0, I have set dependencies correctly (I believe), and I have looked everywhere so i must be doing something very simple incorrectly as no one else seems to have an issue with this. I have…
AranDG
  • 406
  • 4
  • 16
1 2 3 4 5
6