java中使用readline()方法可以读取多少个字符?
我使用 readLine() 方法来读取文本,但我不知道有多少文本可以读取该方法。前任。
String str = in.readLine();
“str”上可以读取和存储多少文本?
I using readLine()
method for reading the text, but i am not aware of how many text can read that method. Ex.
String str = in.readLine();
how many texts can read and store on "str"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
Integer.MAX_VALUE,但显然你不应该经常遇到这个限制。
-- 请注意,这是因为 Integer.MAX_VALUE 是 Java String 的最大大小
Integer.MAX_VALUE, but you obviously should not be running into this limit very often.
-- and note that this is because Integer.MAX_VALUE is the maximum size for a Java String
粗略地说,直到
LINE BREAK
。具体请参见马修的回答。干杯。Till
LINE BREAK
, loosely speaking. For the exact, see Matthew's answer. Cheers.它将读取尽可能多的可用数据,直到遇到 eol
it will read as many as are available until it encounters an eol
这个错误让我相信没有限制。
This bug leads me to believe there is no limit.
如果你需要问这个问题,那么你的问题就更大了。为什么你正在阅读的行这么长以至于你需要担心它?这是上游设计不良的证据。
If you need to ask this question you have a much bigger problem. Why are the lines you are reading so long that you need to worry about it? This is evidence of poor design upstream.