Transmitting String Array over a telephone line
I have a java String array which contains around 2 billion+ entries. Now is there away i can transmit this array over a telephone connection like GPRS or any other means (without using the internet).开发者_开发百科 This might be a dumb question, but i need help
Use a modem and a file transfer protocol like Kermit or Xmodem. The biggest danger is that the size of the data will overflow something in the protocol (like packet number).
With that much data and no internet available, you might also consider FedEx or mail. It might actually be faster.
Sounds like an interview question. ;)
You need to look at ways to compress the data. I suggest using a BitSet for ranges of phone numbers. This will reduce the size of data to about 1-4 bits per phone number. With compression it should be smaller. It would really depend on the data as to the compression ratio you need.
However I agree with @helloandre that its likely to be much faster/simpler/more reliable to copy it to a HD/SSD/Pen drive and courier it.
As a rough estimate, say each array entry is 1240 bits (8 bits per character, 155 characters as a wild guess at average length).
That's 2.48e12 bits. Not including any overhead of how you want to actually represent the data as you push it over the wire.
At 8kb/s (8192 bits/s) that's 9.6 years of data transfer. (For 10 characters in each string, it's still 226 days.)
Put it on an external hard drive and mail it.
精彩评论