-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
49 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
nebulosa-retrofit/src/main/kotlin/nebulosa/retrofit/CSVRecordListConverter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
package nebulosa.retrofit | ||
|
||
import de.siegmar.fastcsv.reader.NamedCsvReader | ||
import de.siegmar.fastcsv.reader.NamedCsvRow | ||
import de.siegmar.fastcsv.reader.CsvReader | ||
import de.siegmar.fastcsv.reader.NamedCsvRecord | ||
import okhttp3.ResponseBody | ||
import retrofit2.Converter | ||
import java.io.InputStreamReader | ||
|
||
data class CSVRecordListConverter(private val reader: NamedCsvReader.NamedCsvReaderBuilder) : Converter<ResponseBody, List<NamedCsvRow>> { | ||
data class CSVRecordListConverter(private val reader: CsvReader.CsvReaderBuilder) : Converter<ResponseBody, List<NamedCsvRecord>> { | ||
|
||
override fun convert(value: ResponseBody): List<NamedCsvRow> { | ||
override fun convert(value: ResponseBody): List<NamedCsvRecord> { | ||
val charset = value.contentType()?.charset() ?: Charsets.UTF_8 | ||
return value.use { reader.build(InputStreamReader(value.byteStream(), charset)).toList() } | ||
return value.use { reader.ofNamedCsvRecord(InputStreamReader(value.byteStream(), charset)).toList() } | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
nebulosa-retrofit/src/main/kotlin/nebulosa/retrofit/CSVRecordListConverterFactory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters