2014-10-09 6 views
0

주석을 무시하고 주석은 '#'문자 및 따옴표가있는 주변 공백으로 시작하지만 opencsv 2.2.0은 작동하지 않습니다. supercsv의 소스를 검색했지만 코드에 사용하지 않은 주석 기능을 생략했습니다. 도와 주시겠습니까?댓글 및 주변 공간 건너 뛰기 supercsv 2.2.

미리 감사드립니다.

답변

0

웹 사이트의 documentation에서 보여 주듯이 CsvPreference 사용자 지정을 만들고이를 CsvReader의 생성자에 전달해야합니다. 예 :

// create the custom preference 
CsvPreference skipCommentsPreference = new CsvPreference.Builder(
    CsvPreference.STANDARD_PREFERENCE) 
    .skipComments(new CommentStartsWith("#").build(); 

// create your reader with the preference 
ICsvBeanReader beanReader = new CsvBeanReader(
    new FileReader("my.csv"), skipCommentsPreference);