Results 1 to 2 of 2

Thread: [RESOLVED]HELP!!Retrieving binary data using Scanner

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2006
    Posts
    21

    Resolved [RESOLVED]HELP!!Retrieving binary data using Scanner

    Code:
    int counter=0;
    Scanner input = new Scanner(new FileReader("/home/huiling/my-cdk/bin.bin"));
    while(input.hasNextBoolean()==true)
    {	
    	counter++;
    	for(int j=0;j<1024;j++)	
    	{			
    		boolean bit = input.nextBoolean();
    	}
    	System.out.println(counter);
    }
    The result is 0 for the counter, but i have binary in my file, does anyone knows why it returns 0? But it works alright when i use FileInputStream and ObjectInputStream. This means my file isn't corrupted or something.
    Or is ther anyway where I can count the number of binaries in a file?
    Last edited by huiling25; Jan 15th, 2007 at 01:43 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width