Skip to content

Commit ff710ca

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents c026fee + 2d373f1 commit ff710ca

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>io.frictionlessdata</groupId>
55
<artifactId>tableschema-java</artifactId>
6-
<version>0.6.11-SNAPSHOT</version>
6+
<version>0.6.12-SNAPSHOT</version>
77
<packaging>jar</packaging>
88
<issueManagement>
99
<url>https://github.com/frictionlessdata/tableschema-java/issues</url>

src/main/java/io/frictionlessdata/tableschema/tabledatasource/TableDataSource.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,7 @@ static TableDataSource fromSource(File input, File workDir) {
9898
* @return DataSource created from input String
9999
*/
100100
static TableDataSource fromSource(InputStream input) {
101-
String content;
102-
103-
try (Reader fr = new InputStreamReader(input)) {
104-
try (BufferedReader rdr = new BufferedReader(fr)) {
105-
content = rdr.lines().collect(Collectors.joining("\n"));
106-
}
107-
} catch (IOException ex) {
108-
throw new TableIOException(ex);
109-
}
110-
101+
String content = readSkippingBOM(input);
111102
return fromSource(content);
112103
}
113104

src/test/java/io/frictionlessdata/tableschema/table_tests/TableBOMTests.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,19 @@ public void testReadFileWithBOMAndSchema() throws Exception{
4444
table.setSchema(schema);
4545
}
4646

47+
@Test
48+
@DisplayName("Create a Table from CSV File with BOM with Schema from Stream and with default CSVFormat")
49+
public void testReadFileWithBOMAndSchemafromInputStream() throws Exception{
50+
File testDataDir = getTestDataDirectory();
51+
// get path of test CSV file
52+
InputStream inputStream = TableBOMTests.class.getClassLoader().getResourceAsStream("fixtures/data/simple_data_bom2.tsv");
53+
File f = new File(getTestDataDirectory(), "schema/simple_data_schema.json");
54+
FileInputStream schemaIs = new FileInputStream(f);
55+
56+
Table table = Table.fromSource(inputStream, schemaIs, csvFormat);
57+
table.validate();
58+
}
59+
4760
@Test
4861
@DisplayName("Create a Table from CSV File with BOM without a Schema from Stream " +
4962
"and with custom CSVFormat")

0 commit comments

Comments
 (0)