-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
22 changed files
with
256 additions
and
267 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
90 changes: 0 additions & 90 deletions
90
easyexcel-core/src/main/java/com/alibaba/excel/analysis/csv/BomBufferedInputStream.java
This file was deleted.
Oops, something went wrong.
108 changes: 0 additions & 108 deletions
108
easyexcel-core/src/main/java/com/alibaba/excel/analysis/csv/ByteOrderMark.java
This file was deleted.
Oops, something went wrong.
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
51 changes: 51 additions & 0 deletions
51
easyexcel-core/src/main/java/com/alibaba/excel/enums/ByteOrderMarkEnum.java
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.alibaba.excel.enums; | ||
|
||
import java.nio.charset.Charset; | ||
import java.util.Map; | ||
|
||
import com.alibaba.excel.util.MapUtils; | ||
|
||
import lombok.Getter; | ||
import org.apache.commons.io.ByteOrderMark; | ||
|
||
/** | ||
* byte order mark | ||
* | ||
* @author Jiaju Zhuang | ||
*/ | ||
@Getter | ||
public enum ByteOrderMarkEnum { | ||
|
||
UTF_8(ByteOrderMark.UTF_8), | ||
UTF_16BE(ByteOrderMark.UTF_16BE), | ||
UTF_16LE(ByteOrderMark.UTF_16LE), | ||
UTF_32BE(ByteOrderMark.UTF_32BE), | ||
UTF_32LE(ByteOrderMark.UTF_32LE), | ||
|
||
; | ||
|
||
final ByteOrderMark byteOrderMark; | ||
final String stringPrefix; | ||
|
||
ByteOrderMarkEnum(ByteOrderMark byteOrderMark) { | ||
this.byteOrderMark = byteOrderMark; | ||
Charset charset = Charset.forName(byteOrderMark.getCharsetName()); | ||
this.stringPrefix = new String(byteOrderMark.getBytes(), charset); | ||
} | ||
|
||
/** | ||
* store character aliases corresponding to `ByteOrderMark` prefix | ||
*/ | ||
private static final Map<String, ByteOrderMarkEnum> CHARSET_BYTE_ORDER_MARK_MAP = MapUtils.newHashMap(); | ||
|
||
static { | ||
for (ByteOrderMarkEnum value : ByteOrderMarkEnum.values()) { | ||
CHARSET_BYTE_ORDER_MARK_MAP.put(value.getByteOrderMark().getCharsetName(), value); | ||
} | ||
} | ||
|
||
public static ByteOrderMarkEnum valueOfByCharsetName(String charsetName) { | ||
return CHARSET_BYTE_ORDER_MARK_MAP.get(charsetName); | ||
} | ||
|
||
} |
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
Oops, something went wrong.