我正在为我的应用程序使用 ZXing 库,并且我使用这个类。但是当我运行我的应用程序时,我在这一行出现错误:
String msg = "123456";
byte[] msgBinary = msg.getBytes(Charset.forName("ISO-8859-1"));
错误如下:
java: no suitable method found for getBytes(java.nio.charset.Charset)
method java.lang.String.getBytes(java.lang.String) is not applicable
(actual argument java.nio.charset.Charset cannot be converted to java.lang.String by method invocation conversion)
method java.lang.String.getBytes(int,int,byte[],int) is not applicable
(actual and formal argument lists differ in length)
method java.lang.String.getBytes() is not applicable
(actual and formal argument lists differ in length)
谁能告诉我这里有什么问题我检查了getBytes输入参数只是String(getBytes(java.lang.String encoding))但Charset.forName返回Charset。这里有什么问题?