scanner

Can you jump a scanner to a location in file or scan backwards?

I have a very large text file and I need to gather data from somewhere near the end. Maybe Scanner isn't the best way to do this but it would be very wasteful to start at the top and grab 6000 lines before getting to the part of the file I am interested in. Is there a way to either tell Scanner to jump to say 7/8ths down the document o...

Restrict string input from user to alphabetic and numerical values

Basically, my situation requires me to check to see if the String that is defined by user input from the keyboard is only alphabetical characters in one case and only digits in another case. This is written in Java. my current code: switch (studentMenu) { case 1: // Change all four fields System.out....

Is there an opensource java library to interface to an image scanner ?

Hello all, I would like to make a tool to capture images from an scanner, is there an opensource java library to control / interface with a scanner? (I found JTwain but is about EUR 3000) Thanks! ...

Strange Scanner error in Java

I'm getting this strange error with "InputMismatchException". It likes to come up randomly in the sequence, and it happens every time I run this code. The data I'm using is this: VERTEX NORMALS # num: x: y: z: 0: 0.509884 0.597177 0.619191 1: -0.000495 0.906886 0.421376 2: -0.514580 0....

scanner.nextLine() doesn't actually give the next line

I've written a pretty simple recursive-descent parser in Java, but having some issues with the scanner I've attached to the file. private void ParseDataFields(Controller.TreeData data, java.util.Scanner scanner) { java.lang.String nextline; while(scanner.hasNextLine()) { nextline = scanner.nextLine().trim(); ...

Scanning - hw custom document size

Hi all, I need to perform a scanning of areas which do not meet standard sizes of A3, A4 etc. Those scans have to be loaded and post processed by custom application. The rough idea of my colleague was to disassemble standard scanner and attach optics + electronic (somehow) to a custom device which will navigate it (continuously) through...

Scanner, useDelimiter

I encounter some problem when using useDelimiter from the Scanner class. Scanner sc = new Scanner(System.in).useDelimiter("-"); while(sc.hasNext()) { System.out.println(sc.next()); } if I have this input A-B-C the output will be A B and wait until I type in another "-" for it to print out the last character However if...

Most efficient way to parse this with the Java Scanner library?

I'm trying to parse a section of a large file with Java's Scanner library, but I'm having a hard time trying to determine the best route to parse this text. SECTOR 199 FLAGS 0x1000 AMBIENT LIGHT 0.67 EXTRA LIGHT 0.00 COLORMAP 0 TINT 0.00 0.00 0.00 BOUNDBOX 7.399998 8.200002 6.199998 9.399998 8.500000 7.099998 COLLIDEBOX 7.605121 8.2307...

How Can I Trigger a Scanner from a Browser?

I have Fujitsu fi-6130 TWAIN / ISIS scanners that I'd like to trigger from a button in a jQuery Rails web page. Not only would I like to have the page tell the scanner to "go", I'd also like to upload the resulting file via Paperclip once the (single) page is scanned - ideally without requiring the user to navigate a file explorer widge...

Is there any sample code for developing the Cardscanning(CSSN) using PHP?

Hi Friends, I want to develop a module for card scanning using CSSN.They gave the sample code for another languages like C#,Delphi etc.(except PHP). Is there any sample code for scanning the document using PHP with this CSSN device?Whether we can develop application for this scanner using PHP?Thanks in advance. ...

can I access scanner attached to system using Adobe Flash?

can I access scanner attached to system using Adobe Flash? ...

Having issues reading Long types from a textfile using Java scanner

I'm trying to read a long type from a text file using Scanner in Java. I get the following error: Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor(Scanner.java:840) at java.util.Scanner.next(Scanner.java:1461) at java.util.Scanner.nextLong(Scanner.java:2196) at java.util.Scanner.nextLong(Scanner....

Problem using the nextLine() and hasNextLine() methods of Scanner

Hi there! I have a log file containing the following data: Shortest path(2)::RV3280-RV0973C-RV2888C Shortest path(1)::RV3280-RV2502C Shortest path(2)::RV3280-RV2501C-RV1263 Shortest path(2)::RV2363-Rv3285-RV3280 From each line, i require the number within the brackets, name of the first protein (RV3280 in the first line) and the nam...

Extracting everything but tags from a web page without a parser - using scanner and regex?

Working on Android SDK, it's Java minus some things. I have a solution that pulls out two regex patterns from web pages. The problems I'm having is that it's finding things inside HTML tags. I tried jTidy, but it was just too slow on the Android. Not sure why but my Scanner regex match solution whips it many times over. currently, I g...

How do you create an array to store regex string matches in java?

I'm trying to take a file that store data of this form: Name=”Biscuit” LatinName=”Retrieverus Aurum” ImageFilename=”Biscuit.png” DNA=”ITAYATYITITIAAYI” and read it with a regex to locate the useful information; namely, the fields and their contents. I have created the regex already, but I can only seem to get one match at any give...

Java Problems - Scanner Input and If (X == Input) Statements

I just read through seven threads related to Java Scanner issues, but none contained the answer to my problem. I'm trying to get user input form the console. I create a Scanner object (input) then try to store the user's command in a string called "command." Then I pass "command" back to the original runGame function. It seems that Scan...

Parse text- Scanner or BufferedReader?

For my data structures class, the first project requires a text file of songs to be parsed. An example of input is: ARTIST="unknown" TITLE="Rockabye Baby" LYRICS="Rockabye baby in the treetops When the wind blows your cradle will rock When the bow breaks your cradle will fall Down will come baby cradle and all " I'm wondering the bes...

Windows Image Acquisition: How to hide scanner setup window

I use WIA library to scan images in my app. Can I set scanner settings (colorfull, grayscell, dpi....) programmaticaly in my app and not show every time scanning settings to end user? I use next code to get an image from scanner public ImageFile Scan() { try { CommonDialog dialog = new Common...

WIA: Store Scanner settings and using it after

I have scanner capability in my application. I want to enable application to provide automatic scanning without requiring user to select every time scanner properties. Which approach I can use to store and use this information ?. I found THIS article on msdn but it probably not for C# application because i cannot find any Inteface and cl...

Enforcing valid input in Java

I have a class I wrote in Java and one of the methods is getCommand() The purpose of this method is to read in a string and see what the user typed in matches any of the acceptable commands. This is how I wrote it initially: public char getCommand(){ System.out.println("Input command: "); command = input.nextLine(); whi...