내 응용 프로그램에 ZXing 라이브러리를 사용하고 있으며 this 클래스를 사용합니다. 하지만 내 응용 프로그램을 실행할 때 나는이 줄에 오류 앙이 :java getBytes error
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 입력 parameteres 오직 String (getBytes (java.lang.String encoding))이지만 Charset.forName은 Charset을 반환합니다. 여기에 어떤 문제가 있습니까?
getBytes (Charset) 메소드는 API 레벨 9에서만 사용 가능합니다. –
getBytes (String) 메소드를 사용하여보십시오. API 레벨 1 이후에 있습니다. 간단히'getBytes() ISO-8591-1 "). –