Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Scanner with File hangs #515

Open
Loccy opened this issue Feb 11, 2019 · 0 comments
Open

Using Scanner with File hangs #515

Loccy opened this issue Feb 11, 2019 · 0 comments
Assignees

Comments

@Loccy
Copy link

Loccy commented Feb 11, 2019

Hi all,

Having run into some issues with using Scanner to read files within the Browser.FS filesystem, I've tried the following on your demo page just to confirm it's not something in my project:

import java.util.Scanner;
import java.io.File;

public class FileTest {
public static void main(String[] args) throws Exception {
File f = new File("test.txt");
Scanner fr = new Scanner(f);
System.out.println("About to try to read...");
while (fr.hasNextLine())
{
System.out.println(fr.nextLine());
}
}
}

I get the same symptoms as in my own project that uses Doppio; the Scanner is instantiated seemingly without incident, but the moment one tries to do anything that involves reading the file, execution seems to hang. It fails silently in that the browser does not block and no console errors are generated.

Attempting a similar simple line-by-line read from a test file using BufferedReader(new FileReader(FILENAME)) works fine - so there seems to be something causing problems in the interaction between Scanner and the Browser.FS-based filesystem.

Have hacked around it for now by using an alternate version of Scanner - see http://nifty.stanford.edu/2006/reges-anagrams/ - but the year on that says it all! Would be nice if the "real" Scanner could be made to work...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants