{"action":"created","comment":{"url":"https://api.github.com/repos/yegor256/cactoos/pulls/comments/184504294","pull_request_review_id":115716089,"id":184504294,"diff_hunk":"@@ -0,0 +1,146 @@\n+/**\n+ * The MIT License (MIT)\n+ *\n+ * Copyright (c) 2017-2018 Yegor Bugayenko\n+ *\n+ * Permission is hereby granted, free of charge, to any person obtaining a copy\n+ * of this software and associated documentation files (the \"Software\"), to deal\n+ * in the Software without restriction, including without limitation the rights\n+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n+ * copies of the Software, and to permit persons to whom the Software is\n+ * furnished to do so, subject to the following conditions:\n+ *\n+ * The above copyright notice and this permission notice shall be included\n+ * in all copies or substantial portions of the Software.\n+ *\n+ * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE\n+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n+ * SOFTWARE.\n+ */\n+package org.cactoos.io;\n+\n+import java.io.IOException;\n+import java.io.InputStream;\n+\n+/**\n+ * An {@link InputStream} that encapsulates other sources of data.\n+ *\n+ * <p>There is no thread-safety guarantee.\n+ *\n+ * @author Mehmet Yildirim (memoyil@gmail.com)\n+ * @version $Id$\n+ * @since 0.29.3\n+ * @checkstyle ClassDataAbstractionCouplingCheck (500 lines)\n+ */\n+public final class HeadInputStream extends InputStream {\n+\n+    /**\n+     * Input.\n+     */\n+    private final InputStream input;\n+\n+    /**\n+     * Length.\n+     */\n+    private final int length;\n+\n+    /**\n+     * Bytesread.\n+     */\n+    private int bytesread;\n+\n+    /**\n+     * Ctor.\n+     * @param src Source of data\n+     * @param length The length\n+     */\n+    public HeadInputStream(final InputStream src, final int length) {\n+        super();\n+        this.input = src;\n+        this.length = length;\n+    }\n+\n+    @Override\n+    public int read() throws IOException {\n+        int data = -1;\n+        if (this.bytesread < this.length) {\n+            data = this.input.read();\n+            this.bytesread += 1;\n+        }\n+        return data;\n+    }\n+\n+    @Override\n+    public int read(final byte[] buf) throws IOException {\n+        int max = -1;","path":"src/main/java/org/cactoos/io/HeadInputStream.java","position":79,"original_position":79,"commit_id":"e189b31f0257b2e2c5c16156a129503141a3d9cf","original_commit_id":"e189b31f0257b2e2c5c16156a129503141a3d9cf","user":{"login":"SharplEr","id":2966206,"avatar_url":"https://avatars0.githubusercontent.com/u/2966206?v=4","gravatar_id":"","url":"https://api.github.com/users/SharplEr","html_url":"https://github.com/SharplEr","followers_url":"https://api.github.com/users/SharplEr/followers","following_url":"https://api.github.com/users/SharplEr/following{/other_user}","gists_url":"https://api.github.com/users/SharplEr/gists{/gist_id}","starred_url":"https://api.github.com/users/SharplEr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SharplEr/subscriptions","organizations_url":"https://api.github.com/users/SharplEr/orgs","repos_url":"https://api.github.com/users/SharplEr/repos","events_url":"https://api.github.com/users/SharplEr/events{/privacy}","received_events_url":"https://api.github.com/users/SharplEr/received_events","type":"User","site_admin":false},"body":"@memoyil The name of this variable is confusing. Use `count` or something like that.","created_at":"2018-04-26T19:26:09Z","updated_at":"2018-04-26T19:26:09Z","html_url":"https://github.com/yegor256/cactoos/pull/767#discussion_r184504294","pull_request_url":"https://api.github.com/repos/yegor256/cactoos/pulls/767","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/yegor256/cactoos/pulls/comments/184504294"},"html":{"href":"https://github.com/yegor256/cactoos/pull/767#discussion_r184504294"},"pull_request":{"href":"https://api.github.com/repos/yegor256/cactoos/pulls/767"}}},"pull_request":{"url":"https://api.github.com/repos/yegor256/cactoos/pulls/767","id":181721379,"html_url":"https://github.com/yegor256/cactoos/pull/767","diff_url":"https://github.com/yegor256/cactoos/pull/767.diff","patch_url":"https://github.com/yegor256/cactoos/pull/767.patch","issue_url":"https://api.github.com/repos/yegor256/cactoos/issues/767","number":767,"state":"open","locked":false,"title":"#764: Head input implementation","user":{"login":"memoyil","id":2213635,"avatar_url":"https://avatars3.githubusercontent.com/u/2213635?v=4","gravatar_id":"","url":"https://api.github.com/users/memoyil","html_url":"https://github.com/memoyil","followers_url":"https://api.github.com/users/memoyil/followers","following_url":"https://api.github.com/users/memoyil/following{/other_user}","gists_url":"https://api.github.com/users/memoyil/gists{/gist_id}","starred_url":"https://api.github.com/users/memoyil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/memoyil/subscriptions","organizations_url":"https://api.github.com/users/memoyil/orgs","repos_url":"https://api.github.com/users/memoyil/repos","events_url":"https://api.github.com/users/memoyil/events{/privacy}","received_events_url":"https://api.github.com/users/memoyil/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-04-15T21:16:37Z","updated_at":"2018-04-26T19:26:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"495b052b1314c81066d0b0e07afe433edcb3716d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":817650738,"url":"https://api.github.com/repos/yegor256/cactoos/labels/scope","name":"scope","color":"3a6622","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/yegor256/cactoos/pulls/767/commits","review_comments_url":"https://api.github.com/repos/yegor256/cactoos/pulls/767/comments","review_comment_url":"https://api.github.com/repos/yegor256/cactoos/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yegor256/cactoos/issues/767/comments","statuses_url":"https://api.github.com/repos/yegor256/cactoos/statuses/e189b31f0257b2e2c5c16156a129503141a3d9cf","head":{"label":"memoyil:Head_Input_Implementation","ref":"Head_Input_Implementation","sha":"e189b31f0257b2e2c5c16156a129503141a3d9cf","user":{"login":"memoyil","id":2213635,"avatar_url":"https://avatars3.githubusercontent.com/u/2213635?v=4","gravatar_id":"","url":"https://api.github.com/users/memoyil","html_url":"https://github.com/memoyil","followers_url":"https://api.github.com/users/memoyil/followers","following_url":"https://api.github.com/users/memoyil/following{/other_user}","gists_url":"https://api.github.com/users/memoyil/gists{/gist_id}","starred_url":"https://api.github.com/users/memoyil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/memoyil/subscriptions","organizations_url":"https://api.github.com/users/memoyil/orgs","repos_url":"https://api.github.com/users/memoyil/repos","events_url":"https://api.github.com/users/memoyil/events{/privacy}","received_events_url":"https://api.github.com/users/memoyil/received_events","type":"User","site_admin":false},"repo":{"id":93142461,"name":"cactoos","full_name":"memoyil/cactoos","owner":{"login":"memoyil","id":2213635,"avatar_url":"https://avatars3.githubusercontent.com/u/2213635?v=4","gravatar_id":"","url":"https://api.github.com/users/memoyil","html_url":"https://github.com/memoyil","followers_url":"https://api.github.com/users/memoyil/followers","following_url":"https://api.github.com/users/memoyil/following{/other_user}","gists_url":"https://api.github.com/users/memoyil/gists{/gist_id}","starred_url":"https://api.github.com/users/memoyil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/memoyil/subscriptions","organizations_url":"https://api.github.com/users/memoyil/orgs","repos_url":"https://api.github.com/users/memoyil/repos","events_url":"https://api.github.com/users/memoyil/events{/privacy}","received_events_url":"https://api.github.com/users/memoyil/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/memoyil/cactoos","description":"Object-Oriented Java Primitives","fork":true,"url":"https://api.github.com/repos/memoyil/cactoos","forks_url":"https://api.github.com/repos/memoyil/cactoos/forks","keys_url":"https://api.github.com/repos/memoyil/cactoos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/memoyil/cactoos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/memoyil/cactoos/teams","hooks_url":"https://api.github.com/repos/memoyil/cactoos/hooks","issue_events_url":"https://api.github.com/repos/memoyil/cactoos/issues/events{/number}","events_url":"https://api.github.com/repos/memoyil/cactoos/events","assignees_url":"https://api.github.com/repos/memoyil/cactoos/assignees{/user}","branches_url":"https://api.github.com/repos/memoyil/cactoos/branches{/branch}","tags_url":"https://api.github.com/repos/memoyil/cactoos/tags","blobs_url":"https://api.github.com/repos/memoyil/cactoos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/memoyil/cactoos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/memoyil/cactoos/git/refs{/sha}","trees_url":"https://api.github.com/repos/memoyil/cactoos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/memoyil/cactoos/statuses/{sha}","languages_url":"https://api.github.com/repos/memoyil/cactoos/languages","stargazers_url":"https://api.github.com/repos/memoyil/cactoos/stargazers","contributors_url":"https://api.github.com/repos/memoyil/cactoos/contributors","subscribers_url":"https://api.github.com/repos/memoyil/cactoos/subscribers","subscription_url":"https://api.github.com/repos/memoyil/cactoos/subscription","commits_url":"https://api.github.com/repos/memoyil/cactoos/commits{/sha}","git_commits_url":"https://api.github.com/repos/memoyil/cactoos/git/commits{/sha}","comments_url":"https://api.github.com/repos/memoyil/cactoos/comments{/number}","issue_comment_url":"https://api.github.com/repos/memoyil/cactoos/issues/comments{/number}","contents_url":"https://api.github.com/repos/memoyil/cactoos/contents/{+path}","compare_url":"https://api.github.com/repos/memoyil/cactoos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/memoyil/cactoos/merges","archive_url":"https://api.github.com/repos/memoyil/cactoos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/memoyil/cactoos/downloads","issues_url":"https://api.github.com/repos/memoyil/cactoos/issues{/number}","pulls_url":"https://api.github.com/repos/memoyil/cactoos/pulls{/number}","milestones_url":"https://api.github.com/repos/memoyil/cactoos/milestones{/number}","notifications_url":"https://api.github.com/repos/memoyil/cactoos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/memoyil/cactoos/labels{/name}","releases_url":"https://api.github.com/repos/memoyil/cactoos/releases{/id}","deployments_url":"https://api.github.com/repos/memoyil/cactoos/deployments","created_at":"2017-06-02T08:05:12Z","updated_at":"2018-04-13T07:42:11Z","pushed_at":"2018-04-24T13:42:53Z","git_url":"git://github.com/memoyil/cactoos.git","ssh_url":"git@github.com:memoyil/cactoos.git","clone_url":"https://github.com/memoyil/cactoos.git","svn_url":"https://github.com/memoyil/cactoos","homepage":"http://www.cactoos.org","size":1883,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"yegor256:master","ref":"master","sha":"b4223ce3e096424397e33058568b587844d93b24","user":{"login":"yegor256","id":526301,"avatar_url":"https://avatars3.githubusercontent.com/u/526301?v=4","gravatar_id":"","url":"https://api.github.com/users/yegor256","html_url":"https://github.com/yegor256","followers_url":"https://api.github.com/users/yegor256/followers","following_url":"https://api.github.com/users/yegor256/following{/other_user}","gists_url":"https://api.github.com/users/yegor256/gists{/gist_id}","starred_url":"https://api.github.com/users/yegor256/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yegor256/subscriptions","organizations_url":"https://api.github.com/users/yegor256/orgs","repos_url":"https://api.github.com/users/yegor256/repos","events_url":"https://api.github.com/users/yegor256/events{/privacy}","received_events_url":"https://api.github.com/users/yegor256/received_events","type":"User","site_admin":false},"repo":{"id":92192594,"name":"cactoos","full_name":"yegor256/cactoos","owner":{"login":"yegor256","id":526301,"avatar_url":"https://avatars3.githubusercontent.com/u/526301?v=4","gravatar_id":"","url":"https://api.github.com/users/yegor256","html_url":"https://github.com/yegor256","followers_url":"https://api.github.com/users/yegor256/followers","following_url":"https://api.github.com/users/yegor256/following{/other_user}","gists_url":"https://api.github.com/users/yegor256/gists{/gist_id}","starred_url":"https://api.github.com/users/yegor256/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yegor256/subscriptions","organizations_url":"https://api.github.com/users/yegor256/orgs","repos_url":"https://api.github.com/users/yegor256/repos","events_url":"https://api.github.com/users/yegor256/events{/privacy}","received_events_url":"https://api.github.com/users/yegor256/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yegor256/cactoos","description":"Object-Oriented Java primitives, as an alternative to Google Guava and Apache Commons","fork":false,"url":"https://api.github.com/repos/yegor256/cactoos","forks_url":"https://api.github.com/repos/yegor256/cactoos/forks","keys_url":"https://api.github.com/repos/yegor256/cactoos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yegor256/cactoos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yegor256/cactoos/teams","hooks_url":"https://api.github.com/repos/yegor256/cactoos/hooks","issue_events_url":"https://api.github.com/repos/yegor256/cactoos/issues/events{/number}","events_url":"https://api.github.com/repos/yegor256/cactoos/events","assignees_url":"https://api.github.com/repos/yegor256/cactoos/assignees{/user}","branches_url":"https://api.github.com/repos/yegor256/cactoos/branches{/branch}","tags_url":"https://api.github.com/repos/yegor256/cactoos/tags","blobs_url":"https://api.github.com/repos/yegor256/cactoos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yegor256/cactoos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yegor256/cactoos/git/refs{/sha}","trees_url":"https://api.github.com/repos/yegor256/cactoos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yegor256/cactoos/statuses/{sha}","languages_url":"https://api.github.com/repos/yegor256/cactoos/languages","stargazers_url":"https://api.github.com/repos/yegor256/cactoos/stargazers","contributors_url":"https://api.github.com/repos/yegor256/cactoos/contributors","subscribers_url":"https://api.github.com/repos/yegor256/cactoos/subscribers","subscription_url":"https://api.github.com/repos/yegor256/cactoos/subscription","commits_url":"https://api.github.com/repos/yegor256/cactoos/commits{/sha}","git_commits_url":"https://api.github.com/repos/yegor256/cactoos/git/commits{/sha}","comments_url":"https://api.github.com/repos/yegor256/cactoos/comments{/number}","issue_comment_url":"https://api.github.com/repos/yegor256/cactoos/issues/comments{/number}","contents_url":"https://api.github.com/repos/yegor256/cactoos/contents/{+path}","compare_url":"https://api.github.com/repos/yegor256/cactoos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yegor256/cactoos/merges","archive_url":"https://api.github.com/repos/yegor256/cactoos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yegor256/cactoos/downloads","issues_url":"https://api.github.com/repos/yegor256/cactoos/issues{/number}","pulls_url":"https://api.github.com/repos/yegor256/cactoos/pulls{/number}","milestones_url":"https://api.github.com/repos/yegor256/cactoos/milestones{/number}","notifications_url":"https://api.github.com/repos/yegor256/cactoos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yegor256/cactoos/labels{/name}","releases_url":"https://api.github.com/repos/yegor256/cactoos/releases{/id}","deployments_url":"https://api.github.com/repos/yegor256/cactoos/deployments","created_at":"2017-05-23T16:00:02Z","updated_at":"2018-04-25T19:46:01Z","pushed_at":"2018-04-26T07:29:47Z","git_url":"git://github.com/yegor256/cactoos.git","ssh_url":"git@github.com:yegor256/cactoos.git","clone_url":"https://github.com/yegor256/cactoos.git","svn_url":"https://github.com/yegor256/cactoos","homepage":"http://www.cactoos.org","size":1915,"stargazers_count":332,"watchers_count":332,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":77,"mirror_url":null,"archived":false,"open_issues_count":52,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":77,"open_issues":52,"watchers":332,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yegor256/cactoos/pulls/767"},"html":{"href":"https://github.com/yegor256/cactoos/pull/767"},"issue":{"href":"https://api.github.com/repos/yegor256/cactoos/issues/767"},"comments":{"href":"https://api.github.com/repos/yegor256/cactoos/issues/767/comments"},"review_comments":{"href":"https://api.github.com/repos/yegor256/cactoos/pulls/767/comments"},"review_comment":{"href":"https://api.github.com/repos/yegor256/cactoos/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yegor256/cactoos/pulls/767/commits"},"statuses":{"href":"https://api.github.com/repos/yegor256/cactoos/statuses/e189b31f0257b2e2c5c16156a129503141a3d9cf"}},"author_association":"NONE"}}
{"actor":{"display_login":"SharplEr"}}