通过电话线传输字符串数组
我有一个 java String 数组,其中包含大约 20 亿多个条目。现在我可以通过电话连接(如 GPRS)或任何其他方式(不使用互联网)传输该阵列。 这可能是一个愚蠢的问题,但我需要帮助
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用调制解调器和文件传输协议,例如 Kermit 或 Xmodem。最大的危险是数据的大小会溢出协议中的某些内容(例如数据包数量)。
由于数据量很大且没有互联网可用,您还可以考虑联邦快递或邮件。实际上可能会更快。
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.
听起来像是面试问题。 ;)
您需要研究压缩数据的方法。我建议对电话号码范围使用 BitSet。这会将每个电话号码的数据大小减少到大约 1-4 位。通过压缩,它应该更小。这实际上取决于您所需的压缩比的数据。
不过,我同意@helloandre的观点,将其复制到HD/SSD/笔式驱动器并快递可能会更快/更简单/更可靠。
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.
作为粗略估计,假设每个数组条目为 1240 位(每个字符 8 位,平均长度为 155 个字符)。
那是 2.48e12 位。不包括当您通过网络推送数据时您想要如何实际表示数据的任何开销。
以 8kb/s(8192 位/秒)的速度传输数据需要 9.6 年。 (每个字符串有 10 个字符,仍然是 226 天。)
将其放在外部硬盘驱动器上并邮寄。
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.