New Stream API and I/O streams - Any overlap?

I know the new Stream API is for processing object streams, often from collections.
But is this notion applicable to I/O streams, too?
It definitely seems compelling to use a functional approach to I/O streams that supports parallelism.
Let me know if my question doesn't make any sense to you
Thanks
Oliver

Indeed, there is some interplay between the APIs.
For example BufferedReader defines a lines() method that returns a (lazily-read) Stream<String>, each element being a line. The Files class in java.nio.file has a utility lines(Path path) method.
So assuming you have some class MyClass, some MyClassParser with a parse method, you can use idioms like
void processFile(Path path) throws IOException {
    MyClassParser parser = ... ;
    try (Stream<String> lines = Files.lines(path)) {
        lines.map(parser::parse).forEach( myObject -> ...);
If you want to parallelize it, do
lines.parallel().map(parser::parse)...
(assuming your parser.parse method can handle multiple threads)

Similar Messages

  • The backup to my new 5S stopped and won't go any further

    the backup to my new 5S stopped and won't go any further

    clyne wrote:
    Yes Yes i have tried both of these and i had absolutely no luck whatsover, Do you have an other suggestions or any further information to help figure out whats wrong or what to do?
    This is just a data point and may not apply to your MBA but it might point you in the direction of the failure. 
    I have a mid-2011 13" MBA that developed symptoms similar to yours.  As it is still under warranty I called Apple and went through a lot of 'hold these keys on startup' checks and none of them worked so I was asked to take it to an Apple store or an AASP.  I chose the latter because it is only 20 miles away and the nearest Apple store is 70 miles away.  The AASP shipped it to their central repair facility which, coincidentaly, is near the Apple store but their central repair faciltiy couldn't fix it, either, and shipped it to Apple in Houston, TX.
    When I received it back (4 days later--pretty quick turn around especially since going through a middle man) the repair order stated that they replaced the 'logic board, 1.8GHz, 4GB'.

  • Use HTTP Dynamic Streaming (HDS) and HTTP Live Streaming (HLS) to serve live streams to clients over HTTP

    I have created a live stream of a video and it gets stored in live folder.
    Now i need to use HTTP Dynamic Streaming (HDS) and HTTP Live Streaming (HLS) to serve live streams to clients over HTTP, publish the streams to the HTTP Live Packager service on Flash Media Server.
    So what necessary steps do I  need to follow to do that ??

    You need to generate a manifest file using Configurator tool and placed it under the webroot directory.
    C:\Program Files\Adobe\Flash Media Server 4.5\tools\f4mconfig\configurator

  • Any word on a firewire to thunderbolt cable?  Got a new MacBook Pro and can't do any work on it til I can get to my data that's stored on my firewire-accessible external hard drive!

    Any word on a firewire to thunderbolt cable?  Got a new MacBook Pro and no way to access my data because my data is stored on an external hard drive accessible only by firewire! 

    This is really starting to be annoying.  Apple said this adapter would be available in July. 
    Of course we could always buy the Thunderbolt Display.  For $999.  Complete with USB 2 ports.  That's not why we bought your MBP-Retina, Guys.  We expected connectivity -- high speed connectivity -- as you promised.
    I also had an Apple store rep tell me that the adapter would be availble in September.  Hate to say it but it feels like Apple is resorting to selling vaporware.  It's a page out of the Bill Gates play book.

  • Every time I close FF it reverts to new install settings and doesn't retain any settings, I have uninstalled & reinstalled but no change - help

    I installed FF and used it without issue, but on loading it for me next session and every subsequent session it reverts to the state it was as a new install including not retaining any settings for loaded extensions. This is a total pain and is likely to lead me to uninstalling if I cannot find a fix soon. I have uninstalled and re-installed and tried re-set but neither has made any difference.

    You can check for problems with preferences and try to rename or delete the prefs.js file and possible numbered prefs-##.js files and a possible user.js file to reset all prefs to the default values.
    *http://kb.mozillazine.org/Preferences_not_saved

  • New to this and can't open any files

    I'm real new to this InDesign program and already have a problem.  I can't open any Photoshop files, esp files, pdf files.  I can't even open InDesign files. I get a message that I am missing plug ins.  What am I **** wrong.  When the program was installed, it was a full install.
    Can anyone help me with this?

    View  > Display Performance > High Quality Display
    or (my usual) right click, Display Performance > High Quality Display
    ID is saving some processing power by default.

  • Just installed new OS (mavericks) and lost mail folders. any advice?

    I had set up several mail folders. When I installed the new Mavericks OS they all disappeared. Left with Inbox, Sent, Drafts, Trash and Junk. Is there a way of recovering the lost folders? Some very important info in them.

    I had set up several mail folders. When I installed the new Mavericks OS they all disappeared. Left with Inbox, Sent, Drafts, Trash and Junk. Is there a way of recovering the lost folders? Some very important info in them.

  • Update my ipad new to ios7 and now cannot download any app from APP store, update my ipad new to ios7 and now cannot download any app from APP store

    even free app when i start to download it s going on loading and the terminate by itself without giving me a notice sometimes also say that cannot connect to the store any advice?

    You could try deleting the app which is still installing. If it doens't work, hold power and home button together for more than 15 seconds to reset the phone. Once the phone is restarted, try deleting the app again. Hope this helps.

  • National characters and new Java API

    Hi All,
    I'm looking for your experience with new java api and national characters (like: ü, &#347;, &#263;, etc.). The problem is that when record was updated using MDM Data Manager, and retrieved using new java api - national character are invalid (in java string the national character are represented incorrectly).
    It's strange due to fact that when I create or update this record from java API it's looks fine. Second finding is that old java api (MDM4J) works fine on text fields with national characters.
    Maybe I forget to set something in server configuration / repository / or on java api connection - any help appreciated...
    Regards, marcin

    While retrieving data via the Java API 2,
    you should set the Unicode Normalization after the user session is authenticated.
    I guess this is available in SP5 patch.
    The documentation for this is available at
    https://help.sap.com/javadocs/MDM/current/index.html
    Package: com.sap.mdm.commands
    SetUnicodeNormalizationCommand cmd = new SetUnicodeNormalizationCommand(connectionAccessor);
    cmd.setSession(userSession);
    <b>cmd.setNormalizationType</b>(SetUnicodeNormalizationCommand.NORMALIZATION_COMPOSED);
    cmd.execute();
    This command is used to set the Unicode normalization.  This is used for the lifetime of the session. It should be set after the session is authenticated.
    Unicode normalization is important when a text string is represented differently depending on the normalization used. The MDM server always store text strings in one normalization format. An user providing a text string to the MDM server and later on tries to retrieve back the same text string might get the text string back in a different normalization. To resolve this issue, the user can use this class to specify the normalization the user wants to work with. The MDM server will always return text strings in the normalization specified by this class.

  • I have a New MacBook Pro and am unable to open Word docx.  What do I do?

    I have a new macbook pro and can't convert any windows docx, xlsx, etc files

    You need Office 2011. What version do you have installed? If the MB is new it did not come with Office pre-installed unless you purchased it along with the computer.

  • New Ipad 2 and no Wifi

    I have a new Ipad 2 and it can find any wifi connection. At any place. After reseted my network devices the Ipad find a connection but just for 10 minutes and than a have to reset again. Which kind of problem is this?

    i have an ipad 2, 3 iphones and a touch connected to my network without a hitch, bought a new ipad 2 yesterday and it will not connect to the network, it sees it, but all we get is a constant spinning circle trying to connect. we have reset the router, reset the network settings on ipad, reset all settings on ipad, reset them with the router turned off, renamed the router and changed the password (everything else can still conect with new password), ios updated to 5.1, disabled the security on router (re-enabled now) turned ipad off and on, turned wifi off and on on ipad, off again and left it before turning it back on and am now utterly lost as to what next...

  • Hey guys, I have an ipad2. Am a new user of apple products. Currently am having trouble streaming movies and series online...I seem to only be able t watch YouTube video from the YouTube app installed on the iPad. Please any suggestions?

    Hey guys, I have an ipad2. Am a new user of apple products. Currently am having trouble streaming movies and series online...I seem to only be able t watch YouTube video from the YouTube app installed on the iPad. Please any suggestions?

    Currently am having trouble streaming movies and series online...
    From where? Using which apps?

  • When streaming a movie with the new Apple TV, and using a DSL Internet connection, all audio sound works, e.g., the music track, but the audio track with the actor's voices, does not work. What can I do?

    When streaming a movie with the new Apple TV, and using a DSL Internet connection, all audio sound works, e.g., the music track, but the audio track with the actor's voices, does not work. What can I do?

    Hi Brian,
    Thanks restoring and restarting didn't fix my problem - i have started it fresh and still it doesn't work. Basically I press ONCE on the remote, after the machine has not had any commands for 10 minutes, and the cursor skips from one end of the menu to the other - so I can't choose network or update software etc - I sometimes manage to stop it randomly in the middle of the menu if I press on a command in the middle of the cursor skipping all the menu steps...not sure what the problem is but I have basically not used my brand new apple tv since I bought it for that reason! I should call Apple support I suppose! grrrr hate wasting time with stuff like this!
    Thanks for your help though!
    Pernille

  • Before 8.3 update when I saved photos they were added to my camera roll. Then I could access the photo I wanted from any app. Now when I SAVE a photo it is not added to the camera roll at all. iCloud photo is on. AND my Photo Stream is GONE entirely.

    Hi all.  Since updating my iphone 6 a couple days ago, I have discovered awful glitches in photos. When I save photos they do not get added to my camera roll. My Camera Roll and Photo Stream used to match.  I would take a photo on the camera and I would see it on my photo stream.  Yesterday, I added an edited photo to my camera roll by saving it (I thought).  But it was not there.  In the past, if I wanted a photo to post in any app, from Twitter to Facebook to Yelp, in order to retrieve it easily (if I had a lot of photos on my phone) I would sometimes text it to myself and then save it. It would be added to my camera roll. Then, when any app asked me to upload a photo, I could find it right at the beginning of my camera roll photos.  Now, when I save a photo it does not appear on my camera roll.  I discovered this yesterday when posting a Yelp review.  I found the photo I wanted to use on my camera roll and it was way back at the beginning of the camera roll.  I edited the photo.  I saved it. It did not get added to my camera roll.  So then I looked for the photo on the camera roll where I had originally found it way back at the beginning.  The edited version of the photo was gone.  Could not find my photo to upload to Yelp.  Then I discovered it was the same with every other app on the phone.
    PHOTO STREAM DISAPPEARED!   This was my main problem and primary question until I tried to resolve the issue. I saw a message on my phone that said (I thought) that I needed to connect my phone to my laptop to restore icloud backups.   So I manually connected my phone to my Mac Pro Laptop (2011)  and backed up my photos.  I made sure iCloud was turned on for photos.  I have it set to Download and Keep Originals.  It is also set to Upload to My Photo Stream. And iCloud sharing is turned on.
    WHEN I connected my phone to my computer I got a message on my phone about setting it up for personal hotspot and it would not complete the update unless I replied.  At first i did set it up, but it seemed to be an issue, so I simply let my phone and computer use my home wifi network.  I don't need the personal hotspot, but it seemed to affect the photo issue further.
    Now where I used to see Photo Stream and Camera Roll, it simply says All Photos.  I am extremely confused.  This is a mess.  Any suggestions would be much appreciated! 

    I restored it twice, once from icloud backup and then from my computer back up. I just restored again and set it up as a new iphone and now my photos are saving again. I was then able to sync apps and music from my itunes to my phone... So happy you wouldn't believe!!

  • I have a brand new mini mac and a new apple TV. Both have been updated and can see my movies in itunes. I can use Netflix and stream music. I have tried to use my old laptop and it streams video fine. But my new computer only see a spinning circle.

    I have a brand new mini mac and a new apple TV. Both have been updated and can see my movies in itunes. I can use Netflix and stream music. I have tried to use my old laptop and it streams video fine. But my new computer only see a spinning circle.

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It won’t solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of this test is to determine whether the problem is localized to your user account. Enable guest logins* and log in as Guest. Don't use the Safari-only “Guest User” login created by “Find My Mac.”
    While logged in as Guest, you won’t have access to any of your personal files or settings. Applications will behave as if you were running them for the first time. Don’t be alarmed by this; it’s normal. If you need any passwords or other personal data in order to complete the test, memorize, print, or write them down before you begin.
    Test while logged in as Guest. Same problem?
    After testing, log out of the guest account and, in your own account, disable it if you wish. Any files you created in the guest account will be deleted automatically when you log out of it.
    *Note: If you’ve activated “Find My Mac” or FileVault in OS X 10.7 or later, then you can’t enable the Guest account. The "Guest User" login created by "Find My Mac" is not the same. Create a new account in which to test, and delete it, including its home folder, after testing.

Maybe you are looking for