{"id":18103959,"url":"https://github.com/dearblue/ruby-ioposrw","last_synced_at":"2026-04-28T11:03:44.843Z","repository":{"id":56877903,"uuid":"84314198","full_name":"dearblue/ruby-ioposrw","owner":"dearblue","description":"pread/pwrite for ruby","archived":false,"fork":false,"pushed_at":"2018-01-14T07:13:27.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-22T16:58:07.542Z","etag":null,"topics":["io","pread","pwrite","ruby"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dearblue.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.ja.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-08T11:43:41.000Z","updated_at":"2018-01-10T15:19:19.000Z","dependencies_parsed_at":"2022-08-20T11:40:35.462Z","dependency_job_id":null,"html_url":"https://github.com/dearblue/ruby-ioposrw","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/dearblue/ruby-ioposrw","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dearblue%2Fruby-ioposrw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dearblue%2Fruby-ioposrw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dearblue%2Fruby-ioposrw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dearblue%2Fruby-ioposrw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dearblue","download_url":"https://codeload.github.com/dearblue/ruby-ioposrw/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dearblue%2Fruby-ioposrw/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32312562,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T19:15:34.056Z","status":"ssl_error","status_checked_at":"2026-04-26T19:15:15.467Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["io","pread","pwrite","ruby"],"created_at":"2024-10-31T22:13:37.087Z","updated_at":"2026-04-28T11:03:44.821Z","avatar_url":"https://github.com/dearblue.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ioposrw\n\n位置指定IO読み書きメソッド追加拡張ライブラリ\n\n  * Package name: [ioposrw](https://rubygems.org/gems/ioposrw)\n  * Version: 0.4\n  * Production quality: TECHNICAL PREVIEW, METASTABLE\n  * License: [BSD-2-clause License](LICENSE)\n  * Author: dearblue (\u003cmailto:dearblue@users.noreply.github.com\u003e)\n  * Project Page: \u003chttps://github.com/dearblue/ruby-ioposrw\u003e\n\n* * * *\n\n  * [QUICK REFERENCE](QUICKREF.md)\n  * [HISTORY](HISTORY.ja.md) (In Japanese)\n\n\n## これは何?\n\nioposrw は IO インスタンスに位置指定読み書き機能を追加する拡張ライブラリです。\n\nこの機能は ``IO#readat`` / ``IO#writeat`` によって提供されます。\n\nこれらのメソッドは、元々ある ``IO#read`` / ``IO#write`` によって更新されるファイル位置ポインタに影響されません。\n\nマルチスレッド動作中に同じファイルインスタンスの別の領域を読み書きしても、想定通りの動作が期待できます。\n\n追加の機能として、``StringIO#readat`` / ``StringIO#writeat`` も実装してあります (実際に利用する場合は、``require \"ioposrw/stringio\"`` を行って下さい)。\n\n\n## どう使うのか?\n\nライブラリの読み込み:\n\n```ruby:ruby\nrequire \"ioposrw\"\n```\n\nファイルの読み込み:\n\n```ruby:ruby\nFile.open(\"sample.txt\") do |file|\n  buf = \"\"\n  file.readat(200, 100, buf) # sample.txt の先頭 200 バイト位置から\n                             # 100 バイトを buf に読み込む\nend\n```\n\nファイルの書き込み:\n\n```ruby:ruby\nFile.open(\"sample.txt\", \"w\") do |file|\n  buf = \"ごにょごにょ\"\n  file.writeat(200, buf) # sample.txt の先頭 200 バイト位置に buf を書き込む\nend\n```\n\n## 注意事項について\n\n  * Windows 上では、``IO#readat / IO#writeat`` を呼び出すとファイルポインタ (IO#pos) が指定位置の次に変更されます (このことは丁度 ``IO#pos=`` と ``IO#read`` を呼び出した後の状態と考えてください)。\n\n    これは Windows 自身に伴う仕様となります。\n\n\n## 内部の実装方法\n\nPOSIX システムコールの ``pread(2)`` / ``pwrite(2)`` を中心に実装しました。\n\nWindows 環境では ``OVERRAPPED`` 構造体を与えた ``ReadFile`` / ``WriteFile`` をそれぞれ用いて ``pread`` / ``pwrite`` 関数を構築し、あとは同じです。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdearblue%2Fruby-ioposrw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdearblue%2Fruby-ioposrw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdearblue%2Fruby-ioposrw/lists"}