{"action":"created","issue":{"url":"https://api.github.com/repos/akka/akka/issues/20293","repository_url":"https://api.github.com/repos/akka/akka","labels_url":"https://api.github.com/repos/akka/akka/issues/20293/labels{/name}","comments_url":"https://api.github.com/repos/akka/akka/issues/20293/comments","events_url":"https://api.github.com/repos/akka/akka/issues/20293/events","html_url":"https://github.com/akka/akka/pull/20293","id":147603347,"number":20293,"title":"Use JDK7 NIO Path instead of File","user":{"login":"mkiedys","id":3410297,"avatar_url":"https://avatars.githubusercontent.com/u/3410297?v=3","gravatar_id":"","url":"https://api.github.com/users/mkiedys","html_url":"https://github.com/mkiedys","followers_url":"https://api.github.com/users/mkiedys/followers","following_url":"https://api.github.com/users/mkiedys/following{/other_user}","gists_url":"https://api.github.com/users/mkiedys/gists{/gist_id}","starred_url":"https://api.github.com/users/mkiedys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkiedys/subscriptions","organizations_url":"https://api.github.com/users/mkiedys/orgs","repos_url":"https://api.github.com/users/mkiedys/repos","events_url":"https://api.github.com/users/mkiedys/events{/privacy}","received_events_url":"https://api.github.com/users/mkiedys/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/akka/akka/labels/needs-attention","name":"needs-attention","color":"e10c02"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2016-04-12T01:17:38Z","updated_at":"2016-04-20T08:43:57Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/akka/akka/pulls/20293","html_url":"https://github.com/akka/akka/pull/20293","diff_url":"https://github.com/akka/akka/pull/20293.diff","patch_url":"https://github.com/akka/akka/pull/20293.patch"},"body":"#### Rationale\r\n\r\nThis PR makes it possible to use `FileIO` (current documentation [here](http://doc.akka.io/docs/akka/2.4.3/scala/stream/stages-overview.html#file-io-sinks-and-sources)) with in-memory file systems like [Jimfs](https://github.com/google/jimfs) and other non standard file system implementations (like HDFS, GlusterFS and ceph) that provide compatible [FileSystem](https://docs.oracle.com/javase/8/docs/api/java/nio/file/FileSystem.html) implementation.\r\n\r\n#### Changes\r\n\r\nThis pull request ~~replaces [File](https://docs.oracle.com/javase/8/docs/api/java/io/File.html) with~~ adds [Path](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html) ~~in~~ to `FileIO`, `HttpEntity`, `HttpMessage` and `Multipart`.\r\n\r\nI haven't made changes in files listed below. They still expose `File` as part of their interface.\r\n * akka-http/src/main/scala/akka/http/impl/server/RouteStructure.scala\r\n * akka-http/src/main/scala/akka/http/javadsl/server/directives/FileAndResourceDirectives.scala\r\n * akka-http/src/main/scala/akka/http/scaladsl/server/directives/FileUploadDirectives.scala\r\n * akka-http/src/main/scala/akka/http/scaladsl/server/directives/FileAndResourceDirectives.scala\r\n\r\n#### Compatibility\r\n\r\nI personally don't feel that there is a good reason to have `FileIO.fromFile` and `FileIO.toFile` take `File` in addition to `Path` for two reasons:\r\n  * `Path` has advantages over `File` and we should encourage its use\r\n  * `Path` can be easily obtained from `File` by calling [File.toPath](https://docs.oracle.com/javase/8/docs/api/java/io/File.html#toPath--)\r\n\r\nI rely on your judgment to make this decision. Let me know if you would want to have it there.\r\nIt is an open question whether `fromFile` and `toFile` are still best names given the fact that they no longer take `File`. I can rename them to `fromPath` and `toPath`.\r\n\r\n#### Implementation\r\n\r\nNothing is changing here: `FilePublisher` and `FileSubscriber` are backed by [FileChannel](https://docs.oracle.com/javase/8/docs/api/java/nio/channels/FileChannel.html) and it takes `Path` only. \r\n\r\nRelated issue: https://github.com/akka/akka/issues/19483\r\nRelated PR: https://github.com/akka/akka/pull/19455"},"comment":{"url":"https://api.github.com/repos/akka/akka/issues/comments/212332540","html_url":"https://github.com/akka/akka/pull/20293#issuecomment-212332540","issue_url":"https://api.github.com/repos/akka/akka/issues/20293","id":212332540,"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},"created_at":"2016-04-20T08:43:57Z","updated_at":"2016-04-20T08:43:57Z","body":"No rush, we have a load of things to look at, this is in the queue."}}