{"id":23129710,"url":"https://github.com/naxam/okio-android-binding","last_synced_at":"2025-04-04T06:40:50.367Z","repository":{"id":85432384,"uuid":"89001856","full_name":"NAXAM/okio-android-binding","owner":"NAXAM","description":"Xamarin Android Binding Library for Square Okio","archived":false,"fork":false,"pushed_at":"2017-05-28T16:50:54.000Z","size":162,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-09T17:44:47.925Z","etag":null,"topics":["okio","xamarin-android-binding"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NAXAM.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-21T16:09:49.000Z","updated_at":"2018-09-03T04:14:03.000Z","dependencies_parsed_at":"2023-06-03T03:30:11.796Z","dependency_job_id":null,"html_url":"https://github.com/NAXAM/okio-android-binding","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NAXAM%2Fokio-android-binding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NAXAM%2Fokio-android-binding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NAXAM%2Fokio-android-binding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NAXAM%2Fokio-android-binding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NAXAM","download_url":"https://codeload.github.com/NAXAM/okio-android-binding/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247135125,"owners_count":20889420,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["okio","xamarin-android-binding"],"created_at":"2024-12-17T10:10:13.156Z","updated_at":"2025-04-04T06:40:50.343Z","avatar_url":"https://github.com/NAXAM.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Xamarin Android Binding Library\nXamarin Binding Library for [Square Okio](https://github.com/square/okio)\n\n```\nInstall-Package Naxam.SquareUp.Okio\n```\n\n--------\nOkio\n====\n\nOkio is a new library that complements `java.io` and `java.nio` to make it much\neasier to access, store, and process your data.\n\nByteStrings and Buffers\n-----------------------\n\nOkio is built around two types that pack a lot of capability into a\nstraightforward API:\n\n * [**ByteString**][3] is an immutable sequence of bytes. For character data, `String`\n   is fundamental. `ByteString` is String's long-lost brother, making it easy to\n   treat binary data as a value. This class is ergonomic: it knows how to encode\n   and decode itself as hex, base64, and UTF-8.\n\n * [**Buffer**][4] is a mutable sequence of bytes. Like `ArrayList`, you don't need\n   to size your buffer in advance. You read and write buffers as a queue: write\n   data to the end and read it from the front. There's no obligation to manage\n   positions, limits, or capacities.\n\nInternally, `ByteString` and `Buffer` do some clever things to save CPU and\nmemory. If you encode a UTF-8 string as a `ByteString`, it caches a reference to\nthat string so that if you decode it later, there's no work to do.\n\n`Buffer` is implemented as a linked list of segments. When you move data from\none buffer to another, it _reassigns ownership_ of the segments rather than\ncopying the data across. This approach is particularly helpful for multithreaded\nprograms: a thread that talks to the network can exchange data with a worker\nthread without any copying or ceremony.\n\nSources and Sinks\n-----------------\n\nAn elegant part of the `java.io` design is how streams can be layered for\ntransformations like encryption and compression. Okio includes its own stream\ntypes called [`Source`][5] and [`Sink`][6] that work like `InputStream` and\n`OutputStream`, but with some key differences:\n\n * **Timeouts.** The streams provide access to the timeouts of the underlying\n   I/O mechanism. Unlike the `java.io` socket streams, both `read()` and\n   `write()` calls honor timeouts.\n\n * **Easy to implement.** `Source` declares three methods: `read()`, `close()`,\n   and `timeout()`. There are no hazards like `available()` or single-byte reads\n   that cause correctness and performance surprises.\n\n * **Easy to use.** Although _implementations_ of `Source` and `Sink` have only\n   three methods to write, _callers_ are given a rich API with the\n   [`BufferedSource`][7] and [`BufferedSink`][8] interfaces. These interfaces give you\n   everything you need in one place.\n\n * **No artificial distinction between byte streams and char streams.** It's all\n   data. Read and write it as bytes, UTF-8 strings, big-endian 32-bit integers,\n   little-endian shorts; whatever you want. No more `InputStreamReader`!\n\n * **Easy to test.** The `Buffer` class implements both `BufferedSource` and\n   `BufferedSink` so your test code is simple and clear.\n\nSources and sinks interoperate with `InputStream` and `OutputStream`. You can\nview any `Source` as an `InputStream`, and you can view any `InputStream` as a\n`Source`. Similarly for `Sink` and `OutputStream`.\n\nDependable\n----------\n\nOkio started as a component of [OkHttp][1], the capable HTTP+SPDY client\nincluded in Android. It's well-exercised and ready to solve new problems.\n\n\nExample: a PNG decoder\n----------------------\n\nDecoding the chunks of a PNG file demonstrates Okio in practice.\n\n```java\nprivate static final ByteString PNG_HEADER = ByteString.decodeHex(\"89504e470d0a1a0a\");\n\npublic void decodePng(InputStream in) throws IOException {\n  try (BufferedSource pngSource = Okio.buffer(Okio.source(in))) {\n    ByteString header = pngSource.readByteString(PNG_HEADER.size());\n    if (!header.equals(PNG_HEADER)) {\n      throw new IOException(\"Not a PNG.\");\n    }\n\n    while (true) {\n      Buffer chunk = new Buffer();\n\n      // Each chunk is a length, type, data, and CRC offset.\n      int length = pngSource.readInt();\n      String type = pngSource.readUtf8(4);\n      pngSource.readFully(chunk, length);\n      int crc = pngSource.readInt();\n\n      decodeChunk(type, chunk);\n      if (type.equals(\"IEND\")) break;\n    }\n  }\n}\n\nprivate void decodeChunk(String type, Buffer chunk) {\n  if (type.equals(\"IHDR\")) {\n    int width = chunk.readInt();\n    int height = chunk.readInt();\n    System.out.printf(\"%08x: %s %d x %d%n\", chunk.size(), type, width, height);\n  } else {\n    System.out.printf(\"%08x: %s%n\", chunk.size(), type);\n  }\n}\n```\n\nDownload\n--------\n\nDownload [the latest JAR][2] or grab via Maven:\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.squareup.okio\u003c/groupId\u003e\n    \u003cartifactId\u003eokio\u003c/artifactId\u003e\n    \u003cversion\u003e1.12.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\nor Gradle:\n```groovy\ncompile 'com.squareup.okio:okio:1.12.0'\n```\n\nSnapshots of the development version are available in [Sonatype's `snapshots` repository][snap].\n\nProGuard\n--------\n\nIf you are using ProGuard you might need to add the following option:\n```\n-dontwarn okio.**\n```\n\nLicense\n--------\n\n    Copyright 2013 Square, Inc.\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n    \n [1]: https://github.com/square/okhttp\n [2]: https://search.maven.org/remote_content?g=com.squareup.okio\u0026a=okio\u0026v=LATEST\n [3]: http://square.github.io/okio/1.x/okio/okio/ByteString.html\n [4]: http://square.github.io/okio/1.x/okio/okio/Buffer.html\n [5]: http://square.github.io/okio/1.x/okio/okio/Source.html\n [6]: http://square.github.io/okio/1.x/okio/okio/Sink.html\n [7]: http://square.github.io/okio/1.x/okio/okio/BufferedSource.html\n [8]: http://square.github.io/okio/1.x/okio/okio/BufferedSink.html\n [snap]: https://oss.sonatype.org/content/repositories/snapshots/","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaxam%2Fokio-android-binding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaxam%2Fokio-android-binding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaxam%2Fokio-android-binding/lists"}