remove java.nio.charset.StandardCharsets which is not available until Java 7

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1765528 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-10-19 05:00:07 +00:00
parent 17d4d76f4f
commit fec5613aff

View File

@ -29,7 +29,6 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.PushbackInputStream; import java.io.PushbackInputStream;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
@ -55,6 +54,8 @@ import org.apache.poi.util.RLEDecompressingInputStream;
public class VBAMacroReader implements Closeable { public class VBAMacroReader implements Closeable {
protected static final String VBA_PROJECT_OOXML = "vbaProject.bin"; protected static final String VBA_PROJECT_OOXML = "vbaProject.bin";
protected static final String VBA_PROJECT_POIFS = "VBA"; protected static final String VBA_PROJECT_POIFS = "VBA";
// FIXME: When minimum supported version is Java 7, replace with java.nio.charset.StandardCharsets.UTF_16LE
private static final UTF_16LE = Charset.forName("UTF-16LE");
private NPOIFSFileSystem fs; private NPOIFSFileSystem fs;
@ -350,6 +351,6 @@ public class VBAMacroReader implements Closeable {
private String readUnicodeString(RLEDecompressingInputStream in, int unicodeNameRecordLength) throws IOException { private String readUnicodeString(RLEDecompressingInputStream in, int unicodeNameRecordLength) throws IOException {
byte[] buffer = new byte[unicodeNameRecordLength]; byte[] buffer = new byte[unicodeNameRecordLength];
IOUtils.readFully(in, buffer); IOUtils.readFully(in, buffer);
return new String(buffer, Charset.forName("UTF-16LE")); return new String(buffer, UTF_16LE);
} }
} }