zxing 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/zxing.rb~ ADDED
@@ -0,0 +1,54 @@
1
+ raise "ZXing requires JRuby" unless defined?(JRuby)
2
+
3
+ require File.expand_path( File.dirname(__FILE__) + '/core.jar' ) # ZXing core classes
4
+ require File.expand_path( File.dirname(__FILE__) + '/javase.jar' ) # ZXing JavaSE classes
5
+
6
+ require 'uri'
7
+
8
+ # Google ZXing classes
9
+ java_import com.google.zxing.MultiFormatReader
10
+ java_import com.google.zxing.BinaryBitmap
11
+ java_import com.google.zxing.Binarizer
12
+ java_import com.google.zxing.common.GlobalHistogramBinarizer
13
+ java_import com.google.zxing.LuminanceSource
14
+ java_import com.google.zxing.client.j2se.BufferedImageLuminanceSource
15
+
16
+ # Standard Java classes
17
+ java_import javax.imageio.ImageIO
18
+ java_import java.net.URL
19
+
20
+ module ZXing
21
+
22
+ @@decoder = MultiFormatReader.new
23
+
24
+ # Transform the module into a singleton!
25
+ extend self
26
+
27
+ def decode(descriptor)
28
+ begin
29
+ decode!(descriptor)
30
+ rescue NativeException
31
+ return nil
32
+ end
33
+ end
34
+
35
+ def decode!(descriptor)
36
+ descriptor = case descriptor
37
+ when URI.regexp(['http', 'https'])
38
+ URL.new(descriptor)
39
+ else
40
+ Java::JavaIO::File.new(descriptor)
41
+ end
42
+ image = ImageIO.read(descriptor)
43
+ bitmap = to_bitmap(image)
44
+ @@decoder.decode(bitmap).to_s
45
+ end
46
+
47
+ private
48
+
49
+ def to_bitmap(image)
50
+ luminance = BufferedImageLuminanceSource.new(image)
51
+ binarizer = GlobalHistogramBinarizer.new(luminance)
52
+ BinaryBitmap.new(binarizer)
53
+ end
54
+ end
@@ -0,0 +1,967 @@
1
+ !RBIX
2
+ 2390329161478264409
3
+ x
4
+ M
5
+ 1
6
+ n
7
+ n
8
+ x
9
+ 10
10
+ __script__
11
+ i
12
+ 46
13
+ 5
14
+ 7
15
+ 0
16
+ 64
17
+ 47
18
+ 49
19
+ 1
20
+ 1
21
+ 15
22
+ 5
23
+ 7
24
+ 2
25
+ 64
26
+ 47
27
+ 49
28
+ 1
29
+ 1
30
+ 15
31
+ 99
32
+ 7
33
+ 3
34
+ 65
35
+ 49
36
+ 4
37
+ 2
38
+ 13
39
+ 99
40
+ 12
41
+ 7
42
+ 5
43
+ 12
44
+ 7
45
+ 6
46
+ 12
47
+ 65
48
+ 12
49
+ 49
50
+ 7
51
+ 4
52
+ 15
53
+ 49
54
+ 5
55
+ 0
56
+ 15
57
+ 2
58
+ 11
59
+ I
60
+ 6
61
+ I
62
+ 0
63
+ I
64
+ 0
65
+ I
66
+ 0
67
+ n
68
+ p
69
+ 8
70
+ s
71
+ 6
72
+ socket
73
+ x
74
+ 7
75
+ require
76
+ s
77
+ 3
78
+ drb
79
+ x
80
+ 5
81
+ ZXing
82
+ x
83
+ 11
84
+ open_module
85
+ x
86
+ 15
87
+ __module_init__
88
+ M
89
+ 1
90
+ n
91
+ n
92
+ x
93
+ 5
94
+ ZXing
95
+ i
96
+ 49
97
+ 5
98
+ 66
99
+ 65
100
+ 7
101
+ 0
102
+ 45
103
+ 1
104
+ 2
105
+ 7
106
+ 3
107
+ 64
108
+ 65
109
+ 49
110
+ 4
111
+ 0
112
+ 49
113
+ 5
114
+ 2
115
+ 49
116
+ 6
117
+ 2
118
+ 15
119
+ 99
120
+ 7
121
+ 7
122
+ 1
123
+ 65
124
+ 49
125
+ 8
126
+ 3
127
+ 13
128
+ 99
129
+ 12
130
+ 7
131
+ 9
132
+ 12
133
+ 7
134
+ 10
135
+ 12
136
+ 65
137
+ 12
138
+ 49
139
+ 11
140
+ 4
141
+ 15
142
+ 49
143
+ 9
144
+ 0
145
+ 11
146
+ I
147
+ 6
148
+ I
149
+ 0
150
+ I
151
+ 0
152
+ I
153
+ 0
154
+ n
155
+ p
156
+ 12
157
+ x
158
+ 3
159
+ BIN
160
+ x
161
+ 4
162
+ File
163
+ n
164
+ s
165
+ 18
166
+ ../../../bin/zxing
167
+ x
168
+ 11
169
+ active_path
170
+ x
171
+ 11
172
+ expand_path
173
+ x
174
+ 9
175
+ const_set
176
+ x
177
+ 6
178
+ Client
179
+ x
180
+ 10
181
+ open_class
182
+ x
183
+ 14
184
+ __class_init__
185
+ M
186
+ 1
187
+ n
188
+ n
189
+ x
190
+ 6
191
+ Client
192
+ i
193
+ 39
194
+ 5
195
+ 66
196
+ 99
197
+ 7
198
+ 0
199
+ 7
200
+ 1
201
+ 65
202
+ 5
203
+ 49
204
+ 2
205
+ 4
206
+ 15
207
+ 5
208
+ 48
209
+ 3
210
+ 15
211
+ 99
212
+ 7
213
+ 4
214
+ 7
215
+ 5
216
+ 65
217
+ 5
218
+ 49
219
+ 2
220
+ 4
221
+ 15
222
+ 99
223
+ 7
224
+ 6
225
+ 7
226
+ 7
227
+ 65
228
+ 5
229
+ 49
230
+ 2
231
+ 4
232
+ 11
233
+ I
234
+ 5
235
+ I
236
+ 0
237
+ I
238
+ 0
239
+ I
240
+ 0
241
+ n
242
+ p
243
+ 8
244
+ x
245
+ 3
246
+ new
247
+ M
248
+ 1
249
+ n
250
+ n
251
+ x
252
+ 3
253
+ new
254
+ i
255
+ 83
256
+ 5
257
+ 48
258
+ 0
259
+ 19
260
+ 0
261
+ 15
262
+ 45
263
+ 1
264
+ 2
265
+ 45
266
+ 3
267
+ 4
268
+ 43
269
+ 5
270
+ 47
271
+ 101
272
+ 6
273
+ 7
274
+ 7
275
+ 20
276
+ 0
277
+ 47
278
+ 101
279
+ 6
280
+ 63
281
+ 3
282
+ 49
283
+ 8
284
+ 1
285
+ 19
286
+ 1
287
+ 15
288
+ 5
289
+ 20
290
+ 0
291
+ 47
292
+ 49
293
+ 9
294
+ 1
295
+ 10
296
+ 52
297
+ 5
298
+ 7
299
+ 10
300
+ 47
301
+ 49
302
+ 11
303
+ 1
304
+ 15
305
+ 68
306
+ 8
307
+ 32
308
+ 1
309
+ 15
310
+ 5
311
+ 56
312
+ 12
313
+ 47
314
+ 50
315
+ 13
316
+ 0
317
+ 15
318
+ 45
319
+ 14
320
+ 15
321
+ 7
322
+ 16
323
+ 20
324
+ 0
325
+ 47
326
+ 101
327
+ 6
328
+ 63
329
+ 2
330
+ 49
331
+ 17
332
+ 1
333
+ 19
334
+ 2
335
+ 15
336
+ 20
337
+ 2
338
+ 11
339
+ I
340
+ 7
341
+ I
342
+ 3
343
+ I
344
+ 0
345
+ I
346
+ 0
347
+ n
348
+ p
349
+ 18
350
+ x
351
+ 19
352
+ find_available_port
353
+ x
354
+ 2
355
+ IO
356
+ n
357
+ x
358
+ 5
359
+ ZXing
360
+ n
361
+ x
362
+ 3
363
+ BIN
364
+ x
365
+ 4
366
+ to_s
367
+ s
368
+ 1
369
+
370
+ x
371
+ 5
372
+ popen
373
+ x
374
+ 11
375
+ responsive?
376
+ d
377
+ +0.500000000000000000000000000000000000000000000000000000 0
378
+ x
379
+ 5
380
+ sleep
381
+ M
382
+ 1
383
+ p
384
+ 2
385
+ x
386
+ 9
387
+ for_block
388
+ t
389
+ n
390
+ x
391
+ 3
392
+ new
393
+ i
394
+ 15
395
+ 45
396
+ 0
397
+ 1
398
+ 7
399
+ 2
400
+ 21
401
+ 1
402
+ 1
403
+ 49
404
+ 3
405
+ 0
406
+ 49
407
+ 4
408
+ 2
409
+ 11
410
+ I
411
+ 4
412
+ I
413
+ 0
414
+ I
415
+ 0
416
+ I
417
+ 0
418
+ I
419
+ -2
420
+ p
421
+ 5
422
+ x
423
+ 7
424
+ Process
425
+ n
426
+ x
427
+ 3
428
+ INT
429
+ x
430
+ 3
431
+ pid
432
+ x
433
+ 4
434
+ kill
435
+ p
436
+ 3
437
+ I
438
+ 0
439
+ I
440
+ e
441
+ I
442
+ f
443
+ x
444
+ 60
445
+ /Users/ncrespo/Developer/ruby/ruby/zxing/lib/zxing/client.rb
446
+ p
447
+ 0
448
+ x
449
+ 7
450
+ at_exit
451
+ x
452
+ 9
453
+ DRbObject
454
+ n
455
+ s
456
+ 18
457
+ druby://127.0.0.1:
458
+ x
459
+ 12
460
+ new_with_uri
461
+ p
462
+ 17
463
+ I
464
+ -1
465
+ I
466
+ 8
467
+ I
468
+ 0
469
+ I
470
+ 9
471
+ I
472
+ 6
473
+ I
474
+ a
475
+ I
476
+ 20
477
+ I
478
+ c
479
+ I
480
+ 34
481
+ I
482
+ 0
483
+ I
484
+ 36
485
+ I
486
+ e
487
+ I
488
+ 3e
489
+ I
490
+ f
491
+ I
492
+ 50
493
+ I
494
+ 10
495
+ I
496
+ 53
497
+ x
498
+ 60
499
+ /Users/ncrespo/Developer/ruby/ruby/zxing/lib/zxing/client.rb
500
+ p
501
+ 3
502
+ x
503
+ 4
504
+ port
505
+ x
506
+ 13
507
+ remote_client
508
+ x
509
+ 6
510
+ client
511
+ x
512
+ 13
513
+ attach_method
514
+ x
515
+ 7
516
+ private
517
+ x
518
+ 11
519
+ responsive?
520
+ M
521
+ 1
522
+ n
523
+ n
524
+ x
525
+ 11
526
+ responsive?
527
+ i
528
+ 97
529
+ 29
530
+ 67
531
+ 1
532
+ 26
533
+ 93
534
+ 0
535
+ 15
536
+ 26
537
+ 93
538
+ 1
539
+ 15
540
+ 29
541
+ 32
542
+ 0
543
+ 45
544
+ 0
545
+ 1
546
+ 7
547
+ 2
548
+ 64
549
+ 20
550
+ 0
551
+ 49
552
+ 3
553
+ 2
554
+ 19
555
+ 1
556
+ 15
557
+ 2
558
+ 30
559
+ 8
560
+ 61
561
+ 26
562
+ 93
563
+ 2
564
+ 15
565
+ 24
566
+ 13
567
+ 45
568
+ 4
569
+ 5
570
+ 43
571
+ 6
572
+ 12
573
+ 49
574
+ 7
575
+ 1
576
+ 10
577
+ 51
578
+ 8
579
+ 56
580
+ 15
581
+ 3
582
+ 25
583
+ 8
584
+ 61
585
+ 15
586
+ 92
587
+ 2
588
+ 27
589
+ 34
590
+ 92
591
+ 1
592
+ 27
593
+ 30
594
+ 8
595
+ 83
596
+ 26
597
+ 20
598
+ 1
599
+ 9
600
+ 79
601
+ 20
602
+ 1
603
+ 49
604
+ 8
605
+ 0
606
+ 8
607
+ 80
608
+ 1
609
+ 15
610
+ 27
611
+ 34
612
+ 20
613
+ 1
614
+ 9
615
+ 94
616
+ 20
617
+ 1
618
+ 49
619
+ 8
620
+ 0
621
+ 8
622
+ 95
623
+ 1
624
+ 15
625
+ 11
626
+ I
627
+ 8
628
+ I
629
+ 2
630
+ I
631
+ 1
632
+ I
633
+ 1
634
+ n
635
+ p
636
+ 9
637
+ x
638
+ 9
639
+ TCPSocket
640
+ n
641
+ s
642
+ 9
643
+ 127.0.0.1
644
+ x
645
+ 4
646
+ open
647
+ x
648
+ 5
649
+ Errno
650
+ n
651
+ x
652
+ 12
653
+ ECONNREFUSED
654
+ x
655
+ 3
656
+ ===
657
+ x
658
+ 5
659
+ close
660
+ p
661
+ 27
662
+ I
663
+ -1
664
+ I
665
+ 14
666
+ I
667
+ 0
668
+ I
669
+ 15
670
+ I
671
+ 7
672
+ I
673
+ 1b
674
+ I
675
+ e
676
+ I
677
+ 15
678
+ I
679
+ 1c
680
+ I
681
+ 16
682
+ I
683
+ 20
684
+ I
685
+ 0
686
+ I
687
+ 25
688
+ I
689
+ 17
690
+ I
691
+ 34
692
+ I
693
+ 18
694
+ I
695
+ 3d
696
+ I
697
+ 0
698
+ I
699
+ 44
700
+ I
701
+ 1a
702
+ I
703
+ 50
704
+ I
705
+ 0
706
+ I
707
+ 53
708
+ I
709
+ 1a
710
+ I
711
+ 5f
712
+ I
713
+ 0
714
+ I
715
+ 61
716
+ x
717
+ 60
718
+ /Users/ncrespo/Developer/ruby/ruby/zxing/lib/zxing/client.rb
719
+ p
720
+ 2
721
+ x
722
+ 4
723
+ port
724
+ x
725
+ 6
726
+ socket
727
+ x
728
+ 19
729
+ find_available_port
730
+ M
731
+ 1
732
+ n
733
+ n
734
+ x
735
+ 19
736
+ find_available_port
737
+ i
738
+ 84
739
+ 29
740
+ 54
741
+ 1
742
+ 26
743
+ 93
744
+ 0
745
+ 15
746
+ 45
747
+ 0
748
+ 1
749
+ 13
750
+ 71
751
+ 2
752
+ 47
753
+ 9
754
+ 32
755
+ 47
756
+ 49
757
+ 3
758
+ 0
759
+ 13
760
+ 7
761
+ 4
762
+ 64
763
+ 78
764
+ 47
765
+ 49
766
+ 5
767
+ 2
768
+ 15
769
+ 8
770
+ 39
771
+ 7
772
+ 4
773
+ 64
774
+ 78
775
+ 49
776
+ 2
777
+ 2
778
+ 19
779
+ 0
780
+ 15
781
+ 20
782
+ 0
783
+ 49
784
+ 6
785
+ 0
786
+ 79
787
+ 49
788
+ 7
789
+ 1
790
+ 30
791
+ 8
792
+ 70
793
+ 26
794
+ 20
795
+ 0
796
+ 9
797
+ 66
798
+ 20
799
+ 0
800
+ 49
801
+ 8
802
+ 0
803
+ 8
804
+ 67
805
+ 1
806
+ 15
807
+ 27
808
+ 34
809
+ 20
810
+ 0
811
+ 9
812
+ 81
813
+ 20
814
+ 0
815
+ 49
816
+ 8
817
+ 0
818
+ 8
819
+ 82
820
+ 1
821
+ 15
822
+ 11
823
+ I
824
+ 6
825
+ I
826
+ 1
827
+ I
828
+ 0
829
+ I
830
+ 0
831
+ n
832
+ p
833
+ 9
834
+ x
835
+ 9
836
+ TCPServer
837
+ n
838
+ x
839
+ 3
840
+ new
841
+ x
842
+ 8
843
+ allocate
844
+ s
845
+ 9
846
+ 127.0.0.1
847
+ x
848
+ 10
849
+ initialize
850
+ x
851
+ 4
852
+ addr
853
+ x
854
+ 2
855
+ []
856
+ x
857
+ 5
858
+ close
859
+ p
860
+ 15
861
+ I
862
+ -1
863
+ I
864
+ 1d
865
+ I
866
+ 0
867
+ I
868
+ 1e
869
+ I
870
+ 2a
871
+ I
872
+ 1f
873
+ I
874
+ 37
875
+ I
876
+ 21
877
+ I
878
+ 43
879
+ I
880
+ 0
881
+ I
882
+ 46
883
+ I
884
+ 21
885
+ I
886
+ 52
887
+ I
888
+ 0
889
+ I
890
+ 54
891
+ x
892
+ 60
893
+ /Users/ncrespo/Developer/ruby/ruby/zxing/lib/zxing/client.rb
894
+ p
895
+ 1
896
+ x
897
+ 6
898
+ server
899
+ p
900
+ 9
901
+ I
902
+ 2
903
+ I
904
+ 8
905
+ I
906
+ d
907
+ I
908
+ 13
909
+ I
910
+ 11
911
+ I
912
+ 14
913
+ I
914
+ 1c
915
+ I
916
+ 1d
917
+ I
918
+ 27
919
+ x
920
+ 60
921
+ /Users/ncrespo/Developer/ruby/ruby/zxing/lib/zxing/client.rb
922
+ p
923
+ 0
924
+ x
925
+ 13
926
+ attach_method
927
+ p
928
+ 5
929
+ I
930
+ 2
931
+ I
932
+ 5
933
+ I
934
+ 16
935
+ I
936
+ 7
937
+ I
938
+ 31
939
+ x
940
+ 60
941
+ /Users/ncrespo/Developer/ruby/ruby/zxing/lib/zxing/client.rb
942
+ p
943
+ 0
944
+ x
945
+ 13
946
+ attach_method
947
+ p
948
+ 7
949
+ I
950
+ 0
951
+ I
952
+ 1
953
+ I
954
+ 9
955
+ I
956
+ 2
957
+ I
958
+ 12
959
+ I
960
+ 4
961
+ I
962
+ 2e
963
+ x
964
+ 60
965
+ /Users/ncrespo/Developer/ruby/ruby/zxing/lib/zxing/client.rb
966
+ p
967
+ 0