BufferedReader does not reset stream, unable to write more than one

Hi,
The following is a program that tries to read a file and write into 10 files.
I am using bufferedReader.reset() to get to the starting position of the stream, but unfotunately it says mark not supported .
Can anyone please tell me , why the stream does not reset, and do I have to close and then again reopen the input reader to write multiple times. Are there any other alternatives?
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class TestFile {
     public static void main(String args[]) {
          try {               
                              FileReader fr = new FileReader("testinput.txt");
               BufferedReader br = new BufferedReader(fr);
               BufferedWriter out = null;                  
               String line = null;
               String name = "testoutput";
               FileWriter fw = null;
               for(int i=0;i<10;i++){     
                    String fname = name + i + ".txt";
                     fw = new FileWriter(fname ,false);
                     out = new BufferedWriter(fw);                    
                    while((line = br.readLine())!= null){
                         out.write(line);                         
                    out.close();
                    if(br.markSupported()){
                         br.reset();
          } catch (FileNotFoundException fnf) {
               fnf.printStackTrace();
          } catch (IOException e) {               
               e.printStackTrace();
}Exception
java.io.IOException: Stream not marked
     at java.io.BufferedReader.reset(BufferedReader.java:485)
     at TestFile.main(TestFile.java:30)

but unfotunately it says mark not supported No it doesn't. It says
java.io.IOException: Stream not marked
No where in that code are you calling the method "mark" to set a mark and the API for reset says:
Reset the stream to the most recent mark.And it says it throws an IOException
If the stream has never been marked, or if the mark has been invalidated.

Similar Messages

  • Installer does not allow for shortcut changes or more than one

    I have been trying to create a shortcut for the Start Menu and the Desktop. I can create the two shortcuts except they are exactly setup the same. I try to change one or the other and they both revert back to the original settings. In the attached images you will see that I change the subdirectory to nothing. When I come back to the shortcuts area, the subdirectory is back. If I create a second shortcut, it is the same as the first... I cannot change it.
    photo 1: this is how it starts, default
    photo 2: My changes... subdirectory is removed
    photo 3: I leave the shortcuts area
    photo 4: I return to the shortcuts area and the subdirectory is back.
    If I create another shortcut, it will act exactly the same. Both shortcuts will be setup as the first photo. No changes stay.
    What is going on here?
    Attachments:
    shortcuts_setup_anomaly.zip ‏161 KB

    What LabVIEW version is this?
    LabVIEW Champion . Do more with less code and in less time .

  • Unable to write more than 10 case statements in an object in designer

    unable to write more than 10 case statements in an object in designer
    XI 3.0 and XI 3.1
    Please let me know, any known issues.

    Hi,
    yes this is the limitation you cant write more that 10 case statments but you can reduce the number of time you use the case in your object.
    For ex:
    If you are writing few conditions on one field then you can add the login in one case only.
    case when SAL between 100 and 1000 then 'lowsal'
            when SAL between 1000 and 2000 then 'medsal'
            when sal between 2000 and 3000 then highsal
    else
    case when ...then ....
    else
    end
    end
    by following the above ex you can solve your problem.
    But if you are writing case statement based on dofferent columns then write 10 case statements and remaining conditions you can add at the report level.
    using if else condition.
    Hope this will help you....
    Cheers,
    Ravichandra

  • When I read a pdf document using Safari I'm unable to read more than one page of a file. A padlock icon is locked on the tab. Please help.

    When I read a pdf document using Safari on my IPad  I'm unable to read more than one page of a file. A padlock icon is locked on the tab. Please help.

    Hi snoreaustralia,
    It sounds like you just need to associate the PDF filename extension with Acrobat, rather than Preview. Please see this document from the Microsoft Help for instructions on choosing the default program for opening a particular file type (in your case, PDF): Change which programs Windows uses by default - Windows Help
    Best,
    Sara

  • Printing BUT unable to print more than one copy

    When printing, I'm unable to print more than one copy

    Still need help, I want more than one print of one picture in a set.

  • Can we write more than one routing rule in a RS?

    Can we write more than one routing rule in a RS?

    You can specify multiple routing rules for a single operation of a routing service. If no filter is applied, they are all executed. For routing rules with filters, only the target operations for which the filter condition holds are invoked. Priority is based on the order in which they appear in the routing rules window.
    Ronald

  • Unable to open more than one site at a time. The + is not working at all.

    A few days ago I suddenly lost the ability to have more than one web page open. The "+" will not open anything.

    Uninstall the Ask toolbar and it should work again. There is a compatibility issue with the Ask toolbar and Firefox that prevents new tabs from being opened.
    There are a couple of places to check for the Ask toolbar:
    * Check the Windows Control panel for the Ask Toolbar - http://about.ask.com/apn/toolbar/docs/default/faq/en/ff/index.html#na4
    * Also check your list of extensions, you may be able to uninstall it from there - https://support.mozilla.com/kb/Uninstalling+add-ons

  • Not able to view data from more than one data package in PSA

    Hi Friends,
    Desparetly trying to view data in PSA. Problem :
    If i mark more than one datapackage this error raises:
    You must only select one data packet when entering data record numbers
    Message no. RSAODS127
    And there is no change to reset data record numbers.
    What is wrong ?
    Thanks in advance for help.
    Joe
    BW3.5, SP21
    Edited by: J.F.B. on Jul 2, 2009 11:40 AM

    Hi again,
    Seems I'm too stupid for this issue.......
    As I understand there are two ways to view PSA :
    1. PSA maintenance in RSA1
    2. In SE11/SE16 viewing the underlaying transparent table
    ad 1.
    When I try to filter erroneous records for more than one datapackage situation is as described above.
    ad 2.
    Trying to view the table works, but where is the chararcteristic/field marking a  record as erroneous
    in table /BIC/Bxxxxxxxx (table containing PSA-Data) ?
    Thanks
    Joe

  • Unable to sync more than one song at a time

    Hello,
    I am unable to add more than 1 song at a time to my iPhone. Previously I was able to add some music by drag and dropping a whole playlist of about 15 songs. However, now when I drag and drop a playlist to the iPhone section in iTunes, iTunes and the phone identify that its syncing for a second or two and then it stops. The playlist shows up on the iPhone, but no songs are in it...I can only add 1 song at a time. I have tried multiple usb ports on my computer and I also tried using msconfig and disabling all 3rd party services per this article http://docs.info.apple.com/article.html?artnum=302538
    Still the same result. Please help.
    Thanks

    Did you by any chance uncheck the the boxes beside any or all of the songs in the library? Unchecked songs won't play in a playlist or the library unless you select them individually: iTunes: Understanding the Symbols Next to Songs
    Holding down the Control key and clicking the checkbox next to a song in the library or a playlist will toggle the marks for all the songs on or off: : iTunes 7 Keyboard Shortcuts for Windows

  • My iPod Nano will not sync ratings to iTunes if more than one playlist is played

    When I try to sync my iPod back to my computer it will only take song ratings I've changed if I only played music with one playlist.  If I've played more than one it doesn't transfer them and just acts if they never existed.  Why is this?

    If you honestly did not damage the iPod, the broken screen should be covered under warranty. Do you live near an Apple Store?
    JC

  • HT4759 Can't get in Cloud. States ID valid for Apple but not Cloud Account. Is there more than one Cloud. Is the new Windows 8 messing up my iTunes?

    ID is valid for Apple but not iCloud account? Is there more than 1 cloud?

    Welcome to Apple Support Communities
    You are trying to log in iCloud for the first time. You have to set up iCloud first on a iPhone, iPad, iPod touch or Mac before being able to set it up on a PC. See > http://www.apple.com/icloud/setup
    If you haven't got a iPhone, iPod touch, iPad or Mac to set up iCloud, you can't use iCloud until you have one

  • Control (Power on/off, Reset, Delete...) more than one VM at once

    Hello,
    I was wondering if there is a comfortable way to steer several VMs at once via the OVM Manager or scripts/ a CLI?
    For example, if I would like to power on 5 VMs at once, I have to mark the radio button, click 'power on', then the next and so on.
    Especially in some situations (e.g. after a crash) it would be useful to send commands to more than one VM.
    Does anyone know if there is a easy way to achieve this, without e.g. scripting xen commands?
    Greetings

    user11932329 wrote:
    Does anyone know if there is a easy way to achieve this, without e.g. scripting xen commands?You can use the ovmcli tool. It's a command-line interface to the Oracle VM Manager. It's available via ULN or from our Public Yum repository at http://public-yum.oracle.com. You'll need to subscribe to the el5_arch_addons and el5_arch_oracle_addons channels to get it.
    More info at http://blogs.oracle.com/wim/2009/07/cli_is_available.html

  • Unable to connect more than one device

    Hi.
    We have copper Broadband with a fairly decent speed (13MB) and a HH3.
    I run a desktop PC for general internet access but my wife uses an iPad and is always downloading films, music etc. We also have a BT Vision box which is connected via Ethernet direct to the HH3 (there are no issues at all with the Vision).
    The hub is located centrally within very close range of the devices with no major structures blocking the path, indeed wireless strength is excellent.
    For a long time now it has been the case that with one of us on, the other cannot use their device as the connection is either too slow or it actually knocks the other off-line. I used to run an Ethernet connection for my PC (my wife is wireless) but having read that the HH3 does not like mixed connections I bought a wireless dongle which initially seemed to help but now we are back to where we started.
    Re-starting the hub sometimes seems to help but not always and might just be a coincidence.
    Obviously it is very inconveniant being able to only use one device at a time.
    Does this sound like a hub issue?

    It could be a faulty hub because the HH3 should be able to handle multiple connections of both wireless and Ethernet without problem.
    The first thing do do is try a factory reset of the homehub by pressing a pin into the recess button on the rear for about 20 seconds which can often sort out configuration problems.

  • How come its not letting me video chat with more than one people?

    i've chatted before with more than 2 people on ichat but for some reason its not letting me. The plus sign will only show like 2 names meanwhile there are other people on my buddy list that i want to add not the ones in the plus sign. I've exited out of the chat i had with one person and went to the other person to make sure theres is working and it does. so why can;t i chat with 3 people then, and how to add them. If someone can help that would be great! Thanks!

    Perthaps http://docs.info.apple.com/article.html?artnum=304486
    and http://docs.info.apple.com/article.html?artnum=301050
    play into this...
    (if this solves your problem, or is actually helpful towards arriving at a solution to your problem, please consider clicking on either the gold or green star in order to mark this reply as "helpful" or "solved")

  • Unable to use more than one processor group for my threads in a C# app

    Hi,
    I set my .Net 4.5 (or 4.5.1) App.Config to:
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
    <runtime>
    <Thread_UseAllCpuGroups enabled="true"></Thread_UseAllCpuGroups>
    <GCCpuGroup enabled="true"></GCCpuGroup>
    <gcServer enabled="true"></gcServer>
    </runtime>
    <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/>
    </startup>
    </configuration>
    I run my app on a windows server 2012 with a NUMA architecture: 2 x [cpu Xeon E5-2697 v3 at 14 cores each with Hyper Thread activated] => 2 x 14 x 2 = 56 Logical Processors.
    This is TaskManager screenshot:
    My app start 80 threads either from "Thread Class" or "Parallel.For" and in both case it only takes 28 Logical Processors, all from the same Processor Group.
    According to MSDN documentation
    and
    Stephen Toub answer, it should use every Logical Processor of every Processor Group.
    Why does the Task scheduler assign my threads on only one Processor Group?
    I also reported this question to
    StackOverflow which have a lot more information.
    Eric Ouellet

    One thing before all, is that I suggest that you think through your security model before implementing it in UCM. You should ask yourself questions like :
    - Is security really based on department ?
    - Why two departments need to have access to the same category of document ?
    - Is it really security that I need or classification ? Is it a problem if Accouting have access to Finance or you just don't want Marketing documents in a finance related search ?
    - Maybe what you want is that finance guys to have access to marketing document.
    Without a clear business security model, it's hard to find a UCM security model as it is impossible to associate 2 security groups to one document.

Maybe you are looking for

  • Create Delivery from Sales Order Document

    Hello all, I have a business requirement to create deliveries from sales orders in the most effcient way possible.  Our current program uses BDC and calls transaction VL01N, however this has been found to dramatically increase the run-time of this pr

  • How to control the size of live data in Coherence?

    How to control the size of live data in Coherence? See the following statement: Pause times increase as the amount of live data in the heap increases. We recommend not exceeding 70% live data in your heap. This includes primary data, backup data, ind

  • ICloud status not displayed correctly after changing tags

    Hi everybody, I have just below 25 000 songs in the iTunes library that I use for iTunes Match (my complete library is actually much larger but I created a separate library to stay below the 25 000 songs limit). After changing some tags in iTunes (I

  • Pacman not able to download any packages but network appears up

    Here is what I get when trying to update my system right after a base install: # pacman -Syu warning: current locale is invalid; using default "C" locale :: Synchronizing package databases... error: failed retrieving file 'current.db.tar.gz' from mir

  • Airport driving me mad...please help!!

    I recently got a macbook and an airport to connect to the internet. Some days it works fine but some days for no apparent reason the macbook just doesn't find the airport. There are other computers connected to it and they work fine so it must be the