scanner

Simulating a TWAIN Device

Our company is using some software that ONLY accepts input from an "Imaging Device" i.e. a TWAIN device (e.g. scanner). The problem is that we are receiving our files digitally, so using an actual scanner would require us to print, scan, and shred documents that we already have on the computer, but not in the software. I was curious if...

How to get line number using scanner

I'm using scanner to read a text file line by line but then how to get line number since scanner iterates through each input?My program is something like this: s = new Scanner(new BufferedReader(new FileReader("input.txt"))); while (s.hasNext()) { System.out.print(s.next()); This works fine but for example: 1,2,3 3,4,5 I want to...

Does a Java Scanner implicitly create a buffer even if you do not pass it one?

If I have the following example file where each number is represents a byte (123 has bytes 1, 2, and 3): 123456789 Let's say I create a FileInputStream. This reads in the binary byte by byte. So .read() returns 1, then 2, etc. Now let's say I create a buffer. The initial chunk it reads in (if I understand buffers correctly) is 1-5. Th...

Image acquisition hardware scanning from Java

Hi. How can I implement image acquisition from hardware scanner in Windows? I found JTwain library, but it's commercial. Is there any free frameworks? Any information about this? ...

How can I tokenize this with a regex?

Suppose I have strings like the following : OneTwo ThreeFour AnotherString DVDPlayer CDPlayer I know how to tokenize the camel-case ones, except the "DVDPlayer" and "CDPlayer". I know I could tokenize them manually, but maybe you can show me a regex that can handle all the cases? EDIT: the expected tokens are : OneTwo -> One Two ......

Java Scanner class reading strings

I got the following code: int nnames; String names[]; System.out.print("How many names are you going to save: "); Scanner in = new Scanner(System.in); nnames = in.nextInt(); names = new String[nnames]; for (int i = 0; i < names.length; i++){ System.out.print("Type a name: "); names[i] = in.next(); } System.out.printl...

Java Scanner class reading strings

I got the following code: int nnames; String names[]; System.out.print("How many names are you going to save: "); Scanner in = new Scanner(System.in); nnames = in.nextInt(); names = new String[nnames]; for (int i = 0; i < names.length; i++){ System.out.print("Type a name: "); names[i] = ...

How can I paste my scanned signature onto a photograph in a PDF document?

The title says it all. ...

Using Scanner in Java how can I hasNext(aString) where the string is not regex pattern?

Hi, I am trying to do as my question states, sooo I have the following code which would find the match. String test = scan.next(); if (test.equals("$let")) return 1; However, I would prefer to use hasNext as to not consume a token; however, when i do the following it fails. if (scan.hasNext("$let")) return 1; I realize the whe...

Java - Creating a string by selecting certain numbers from within a text file

I have a .txt file that has numbers 1-31 in it called numbers. I've set up a scanner like this: cardCreator = new Scanner (new File ("numbers")); After this, I'm kind of confused on which methods I could use. I want to set up a conditional statement that will go through numbers, evaluate each line (or numbers 1-31), and includ...

Java Scanner Headache

I have a text file which looks like: name1 1 0 1 0 1 0 1 1 1 0 0 0 0 0 0 name2 1 0 1 0 1 0 0 1 1 0 0 0 0 0 1 i.e., a plaintext label followed by a few rows with 1/0 separated by spaces. The number of rows of 1/0 is variable, but each row between any two particular labels should have the same number of 1/0s (though might potentially n...

Java Scanner Delimiter Usage

I'd like to specify a delimiter for a scanner that splits on some pattern, but doesn't remove that pattern from the tokens. I can't seem to make this work, as anything that is identified by the regex also gets eaten as part of the delimiter. Any suggestions? My specific problem, I have file that looks like: text/numbers mix numbers n...

SANE + Python, missing device after close statement

I'm having a trouble using SANE on Python to scan an image on a Kodak scanner. The real headache comes to when I close the scanner device after getting the image, it just disappears from the SANE Devices lists until I restarted the Python interpreter, making impossible to scan another image. It just acts like that with this scanner, I'...

Programatic Image Scanning and Naming

I have a typical yearbook with photos and a name beneath each photo. Is there a programmatic way to scan all of the photos and save them with the name beneath the photo? ...

Site Security Audit

Can anyone recommend a site security audit service? One thats simple to sign up to online and audit sites for xss, sqlinjection, buffer overflow, etc etc. Thanks ...

Interfacing with the end-user's scanner from a webapp (web/scanner integration)

Consider the following scanning procedure in a typical document handling webapp: The user scans a document using a scanner connected to his/her computer The scanned image is saved locally on the user's computer as a BMP/JPG/TIF/PNG file The user hits a file upload "Browse.." button in the web application The user is presented with a fi...

Java file read problem

Hi - I have a java problem. I am trying to read a txt file which has a variable number of integers per line, and for each line I need to sum every second integer! I am using scanner to read integers, but can't work out when a line is done. Can anyone help pls? ...

InputMissMatchException

I want to read data about MMORPG characters from a .txt file and then filter on experience (minimum experience). But I'm getting this exception, which I know the meaning of but I really don't understand what I'm doing wrong. this my code: I'm not good at java, I'm a beginner actually. Can someone please explain this to me. Probably I'm ...

Importing from Text File Java question

Hi all, I decided to create a currency converter in Java, and have it so that it would pull the conversion values out of a text file (to allow for easy editability since these values are constantly changing). I did manage to do it by using the Scanner class and putting all the values into an ArrayList. Now I'm wondering if there is a w...

Need help with scanner class for creating tokens

Errors im getting: cannot find symbol constructor method Token. but i do have a constructor in Token class cannot find symbol variable tokenCode. i clearly use it alll over and i think i initialized it properly so whats wrong? cannot find symbol variable scantest. i have that in same folder where all classes ar...