{"action":"created","comment":{"url":"https://api.github.com/repos/akka/akka/pulls/comments/53044710","id":53044710,"diff_hunk":"@@ -0,0 +1,97 @@\n+/**\n+ * Copyright (C) 2015-2016 Typesafe Inc. <http://www.typesafe.com>\n+ */\n+package akka.stream.javadsl\n+\n+import java.nio.ByteOrder\n+\n+import akka.NotUsed\n+import akka.stream.scaladsl\n+import akka.stream.stage._\n+import akka.util.ByteString\n+\n+object Framing {\n+\n+  /**\n+   * Creates a Flow that handles decoding a stream of unstructured byte chunks into a stream of frames where the\n+   * incoming chunk stream uses a specific byte-sequence to mark frame boundaries.\n+   *\n+   * The decoded frames will not include the separator sequence.\n+   *\n+   * If there are buffered bytes (an incomplete frame) when the input stream finishes and ''allowTruncation'' is set to\n+   * false then this Flow will fail the stream reporting a truncated frame.\n+   *\n+   * @param delimiter The byte sequence to be treated as the end of the frame.\n+   * @param allowTruncation If turned on, then when the last frame being decoded contains no valid delimiter this Flow\n+   *                        fails the stream instead of returning a truncated frame.\n+   * @param maximumFrameLength The maximum length of allowed frames while decoding. If the maximum length is\n+   *                           exceeded this Flow will fail the stream.\n+   */\n+  def delimiter(delimiter: ByteString, maximumFrameLength: Int, allowTruncation: FramingTruncation): Flow[ByteString, ByteString, NotUsed] = {\n+    val truncationAllowed = allowTruncation match {\n+      case FramingTruncation.ALLOW ⇒ true\n+      case _                       ⇒ false\n+    }\n+    scaladsl.Framing.delimiter(delimiter, maximumFrameLength, truncationAllowed).asJava\n+  }\n+\n+  /**\n+   * Creates a Flow that decodes an incoming stream of unstructured byte chunks into a stream of frames, assuming that\n+   * incoming frames have a field that encodes their length.\n+   *\n+   * If the input stream finishes before the last frame has been fully decoded this Flow will fail the stream reporting\n+   * a truncated frame.\n+   *\n+   * @param fieldLength The length of the \"size\" field in bytes\n+   * @param fieldOffset The offset of the field from the beginning of the frame in bytes\n+   * @param maximumFrameLength The maximum length of allowed frames while decoding. If the maximum length is exceeded\n+   *                           this Flow will fail the stream. This length *includes* the header (i.e the offset and\n+   *                           the length of the size field)\n+   */\n+  def lengthField(fieldLength: Int,\n+                  fieldOffset: Int,\n+                  maximumFrameLength: Int): Flow[ByteString, ByteString, NotUsed] =\n+    scaladsl.Framing.lengthField(fieldLength, fieldOffset, maximumFrameLength).asJava\n+\n+  /**\n+   * Creates a Flow that decodes an incoming stream of unstructured byte chunks into a stream of frames, assuming that\n+   * incoming frames have a field that encodes their length.\n+   *\n+   * If the input stream finishes before the last frame has been fully decoded this Flow will fail the stream reporting\n+   * a truncated frame.\n+   *\n+   * @param fieldLength The length of the \"size\" field in bytes\n+   * @param fieldOffset The offset of the field from the beginning of the frame in bytes\n+   * @param maximumFrameLength The maximum length of allowed frames while decoding. If the maximum length is exceeded\n+   *                           this Flow will fail the stream. This length *includes* the header (i.e the offset and\n+   *                           the length of the size field)\n+   * @param byteOrder The ''ByteOrder'' to be used when decoding the field\n+   */\n+  def lengthField(fieldLength: Int,\n+                  fieldOffset: Int,\n+                  maximumFrameLength: Int,\n+                  byteOrder: ByteOrder = ByteOrder.LITTLE_ENDIAN): Flow[ByteString, ByteString, NotUsed] =","path":"akka-stream/src/main/scala/akka/stream/javadsl/Framing.scala","position":73,"original_position":73,"commit_id":"2a5009b5a99bf0ea4c26d9b5486476f482fec4ee","original_commit_id":"2a5009b5a99bf0ea4c26d9b5486476f482fec4ee","user":{"login":"ktoso","id":120979,"avatar_url":"https://avatars.githubusercontent.com/u/120979?v=3","gravatar_id":"","url":"https://api.github.com/users/ktoso","html_url":"https://github.com/ktoso","followers_url":"https://api.github.com/users/ktoso/followers","following_url":"https://api.github.com/users/ktoso/following{/other_user}","gists_url":"https://api.github.com/users/ktoso/gists{/gist_id}","starred_url":"https://api.github.com/users/ktoso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktoso/subscriptions","organizations_url":"https://api.github.com/users/ktoso/orgs","repos_url":"https://api.github.com/users/ktoso/repos","events_url":"https://api.github.com/users/ktoso/events{/privacy}","received_events_url":"https://api.github.com/users/ktoso/received_events","type":"User","site_admin":false},"body":"Ouch, tkanks","created_at":"2016-02-16T17:22:37Z","updated_at":"2016-02-16T17:22:37Z","html_url":"https://github.com/akka/akka/pull/19802#discussion_r53044710","pull_request_url":"https://api.github.com/repos/akka/akka/pulls/19802","_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/comments/53044710"},"html":{"href":"https://github.com/akka/akka/pull/19802#discussion_r53044710"},"pull_request":{"href":"https://api.github.com/repos/akka/akka/pulls/19802"}}},"pull_request":{"url":"https://api.github.com/repos/akka/akka/pulls/19802","id":59518838,"html_url":"https://github.com/akka/akka/pull/19802","diff_url":"https://github.com/akka/akka/pull/19802.diff","patch_url":"https://github.com/akka/akka/pull/19802.patch","issue_url":"https://api.github.com/repos/akka/akka/issues/19802","number":19802,"state":"open","locked":false,"title":"!str split Framing into javadsl and scaladsl","user":{"login":"ktoso","id":120979,"avatar_url":"https://avatars.githubusercontent.com/u/120979?v=3","gravatar_id":"","url":"https://api.github.com/users/ktoso","html_url":"https://github.com/ktoso","followers_url":"https://api.github.com/users/ktoso/followers","following_url":"https://api.github.com/users/ktoso/following{/other_user}","gists_url":"https://api.github.com/users/ktoso/gists{/gist_id}","starred_url":"https://api.github.com/users/ktoso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktoso/subscriptions","organizations_url":"https://api.github.com/users/ktoso/orgs","repos_url":"https://api.github.com/users/ktoso/repos","events_url":"https://api.github.com/users/ktoso/events{/privacy}","received_events_url":"https://api.github.com/users/ktoso/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-16T16:48:40Z","updated_at":"2016-02-16T17:22:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f7fb9a94371ee3a6718572cb472dfb3a55bb5ee7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/akka/akka/pulls/19802/commits","review_comments_url":"https://api.github.com/repos/akka/akka/pulls/19802/comments","review_comment_url":"https://api.github.com/repos/akka/akka/pulls/comments{/number}","comments_url":"https://api.github.com/repos/akka/akka/issues/19802/comments","statuses_url":"https://api.github.com/repos/akka/akka/statuses/2a5009b5a99bf0ea4c26d9b5486476f482fec4ee","head":{"label":"ktoso:wip-framing-made-proper-ktoso","ref":"wip-framing-made-proper-ktoso","sha":"2a5009b5a99bf0ea4c26d9b5486476f482fec4ee","user":{"login":"ktoso","id":120979,"avatar_url":"https://avatars.githubusercontent.com/u/120979?v=3","gravatar_id":"","url":"https://api.github.com/users/ktoso","html_url":"https://github.com/ktoso","followers_url":"https://api.github.com/users/ktoso/followers","following_url":"https://api.github.com/users/ktoso/following{/other_user}","gists_url":"https://api.github.com/users/ktoso/gists{/gist_id}","starred_url":"https://api.github.com/users/ktoso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktoso/subscriptions","organizations_url":"https://api.github.com/users/ktoso/orgs","repos_url":"https://api.github.com/users/ktoso/repos","events_url":"https://api.github.com/users/ktoso/events{/privacy}","received_events_url":"https://api.github.com/users/ktoso/received_events","type":"User","site_admin":false},"repo":{"id":4462204,"name":"akka","full_name":"ktoso/akka","owner":{"login":"ktoso","id":120979,"avatar_url":"https://avatars.githubusercontent.com/u/120979?v=3","gravatar_id":"","url":"https://api.github.com/users/ktoso","html_url":"https://github.com/ktoso","followers_url":"https://api.github.com/users/ktoso/followers","following_url":"https://api.github.com/users/ktoso/following{/other_user}","gists_url":"https://api.github.com/users/ktoso/gists{/gist_id}","starred_url":"https://api.github.com/users/ktoso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktoso/subscriptions","organizations_url":"https://api.github.com/users/ktoso/orgs","repos_url":"https://api.github.com/users/ktoso/repos","events_url":"https://api.github.com/users/ktoso/events{/privacy}","received_events_url":"https://api.github.com/users/ktoso/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ktoso/akka","description":"Akka Project","fork":true,"url":"https://api.github.com/repos/ktoso/akka","forks_url":"https://api.github.com/repos/ktoso/akka/forks","keys_url":"https://api.github.com/repos/ktoso/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ktoso/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ktoso/akka/teams","hooks_url":"https://api.github.com/repos/ktoso/akka/hooks","issue_events_url":"https://api.github.com/repos/ktoso/akka/issues/events{/number}","events_url":"https://api.github.com/repos/ktoso/akka/events","assignees_url":"https://api.github.com/repos/ktoso/akka/assignees{/user}","branches_url":"https://api.github.com/repos/ktoso/akka/branches{/branch}","tags_url":"https://api.github.com/repos/ktoso/akka/tags","blobs_url":"https://api.github.com/repos/ktoso/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ktoso/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ktoso/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/ktoso/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ktoso/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/ktoso/akka/languages","stargazers_url":"https://api.github.com/repos/ktoso/akka/stargazers","contributors_url":"https://api.github.com/repos/ktoso/akka/contributors","subscribers_url":"https://api.github.com/repos/ktoso/akka/subscribers","subscription_url":"https://api.github.com/repos/ktoso/akka/subscription","commits_url":"https://api.github.com/repos/ktoso/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/ktoso/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/ktoso/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/ktoso/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/ktoso/akka/contents/{+path}","compare_url":"https://api.github.com/repos/ktoso/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ktoso/akka/merges","archive_url":"https://api.github.com/repos/ktoso/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ktoso/akka/downloads","issues_url":"https://api.github.com/repos/ktoso/akka/issues{/number}","pulls_url":"https://api.github.com/repos/ktoso/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/ktoso/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/ktoso/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ktoso/akka/labels{/name}","releases_url":"https://api.github.com/repos/ktoso/akka/releases{/id}","deployments_url":"https://api.github.com/repos/ktoso/akka/deployments","created_at":"2012-05-27T14:05:17Z","updated_at":"2015-04-03T11:58:56Z","pushed_at":"2016-02-16T16:48:11Z","git_url":"git://github.com/ktoso/akka.git","ssh_url":"git@github.com:ktoso/akka.git","clone_url":"https://github.com/ktoso/akka.git","svn_url":"https://github.com/ktoso/akka","homepage":"http://akka.io","size":180412,"stargazers_count":1,"watchers_count":1,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"akka:master","ref":"master","sha":"5d3a8256c1d4d742b999676bb5050737b7a45ce4","user":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"repo":{"id":130013,"name":"akka","full_name":"akka/akka","owner":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akka/akka","description":"Akka Project","fork":false,"url":"https://api.github.com/repos/akka/akka","forks_url":"https://api.github.com/repos/akka/akka/forks","keys_url":"https://api.github.com/repos/akka/akka/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akka/akka/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akka/akka/teams","hooks_url":"https://api.github.com/repos/akka/akka/hooks","issue_events_url":"https://api.github.com/repos/akka/akka/issues/events{/number}","events_url":"https://api.github.com/repos/akka/akka/events","assignees_url":"https://api.github.com/repos/akka/akka/assignees{/user}","branches_url":"https://api.github.com/repos/akka/akka/branches{/branch}","tags_url":"https://api.github.com/repos/akka/akka/tags","blobs_url":"https://api.github.com/repos/akka/akka/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akka/akka/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akka/akka/git/refs{/sha}","trees_url":"https://api.github.com/repos/akka/akka/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akka/akka/statuses/{sha}","languages_url":"https://api.github.com/repos/akka/akka/languages","stargazers_url":"https://api.github.com/repos/akka/akka/stargazers","contributors_url":"https://api.github.com/repos/akka/akka/contributors","subscribers_url":"https://api.github.com/repos/akka/akka/subscribers","subscription_url":"https://api.github.com/repos/akka/akka/subscription","commits_url":"https://api.github.com/repos/akka/akka/commits{/sha}","git_commits_url":"https://api.github.com/repos/akka/akka/git/commits{/sha}","comments_url":"https://api.github.com/repos/akka/akka/comments{/number}","issue_comment_url":"https://api.github.com/repos/akka/akka/issues/comments{/number}","contents_url":"https://api.github.com/repos/akka/akka/contents/{+path}","compare_url":"https://api.github.com/repos/akka/akka/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akka/akka/merges","archive_url":"https://api.github.com/repos/akka/akka/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akka/akka/downloads","issues_url":"https://api.github.com/repos/akka/akka/issues{/number}","pulls_url":"https://api.github.com/repos/akka/akka/pulls{/number}","milestones_url":"https://api.github.com/repos/akka/akka/milestones{/number}","notifications_url":"https://api.github.com/repos/akka/akka/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akka/akka/labels{/name}","releases_url":"https://api.github.com/repos/akka/akka/releases{/id}","deployments_url":"https://api.github.com/repos/akka/akka/deployments","created_at":"2009-02-16T12:51:54Z","updated_at":"2016-02-16T10:56:23Z","pushed_at":"2016-02-16T17:14:57Z","git_url":"git://github.com/akka/akka.git","ssh_url":"git@github.com:akka/akka.git","clone_url":"https://github.com/akka/akka.git","svn_url":"https://github.com/akka/akka","homepage":"http://akka.io","size":184288,"stargazers_count":5101,"watchers_count":5101,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1565,"mirror_url":null,"open_issues_count":851,"forks":1565,"open_issues":851,"watchers":5101,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akka/akka/pulls/19802"},"html":{"href":"https://github.com/akka/akka/pull/19802"},"issue":{"href":"https://api.github.com/repos/akka/akka/issues/19802"},"comments":{"href":"https://api.github.com/repos/akka/akka/issues/19802/comments"},"review_comments":{"href":"https://api.github.com/repos/akka/akka/pulls/19802/comments"},"review_comment":{"href":"https://api.github.com/repos/akka/akka/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/akka/akka/pulls/19802/commits"},"statuses":{"href":"https://api.github.com/repos/akka/akka/statuses/2a5009b5a99bf0ea4c26d9b5486476f482fec4ee"}}}}