如何在Java / Scala中跳过流中的无效字符?
2022-09-02 11:44:15
						例如,我有以下代码
Source.fromFile(new File( path), "UTF-8").getLines()
并引发异常
Exception in thread "main" java.nio.charset.MalformedInputException: Input length = 1
    at java.nio.charset.CoderResult.throwException(CoderResult.java:260)
    at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:319)
我不在乎某些行是否未被读取,但是如何跳过无效的字符并继续读取行?
 
					 
				 
				    		 
				    		 
				    		 
				    		