fhueske commented on a change in pull request #6823: [FLINK-10134] UTF-16 
support for TextInputFormat bug refixed
URL: https://github.com/apache/flink/pull/6823#discussion_r225533378
 
 

 ##########
 File path: 
flink-core/src/main/java/org/apache/flink/api/common/io/DelimitedInputFormat.java
 ##########
 @@ -504,16 +533,119 @@ private void initBuffers() {
                this.end = false;
        }
 
+       /**
+        * Set file bom encoding.
+        *
+        * @param split
+        */
+       private void setBomFileCharset(FileInputSplit split) {
+               try {
+                       String filePath = split.getPath().toString();
+                       if (this.fileBomCharsetMap.containsKey(filePath)) {
+                               this.bomCharset = 
this.fileBomCharsetMap.get(filePath);
+                       } else {
+                               byte[] checkBytes = new byte[]{(byte) 0x00, 
(byte) 0xFE, (byte) 0xFF, (byte) 0xEF, (byte) 0xBB, (byte) 0xBF};
+                               byte[] bomBuffer = new byte[4];
+
+                               if (this.splitStart != 0) {
 
 Review comment:
   I don't think it is necessary to optimize for special cases here. We can 
just reset the stream to pos 0 and read the first four bytes.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to