< prev index next >
src/java.base/share/classes/java/nio/file/FileChannelLinesSpliterator.java
Print this page
rev 49550 : 8201179: Regression due loading java.nio.charset.StandardCharsets during bootstrap
Reviewed-by: sherman
*** 30,45 ****
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;
import java.nio.charset.Charset;
- import java.nio.charset.StandardCharsets;
import java.util.HashSet;
import java.util.Set;
import java.util.Spliterator;
import java.util.function.Consumer;
/**
* A file-based lines spliterator, leveraging a shared mapped byte buffer and
* associated file channel, covering lines of a file for character encodings
* where line feed characters can be easily identified from character encoded
* bytes.
--- 30,48 ----
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;
import java.nio.charset.Charset;
import java.util.HashSet;
import java.util.Set;
import java.util.Spliterator;
import java.util.function.Consumer;
+ import sun.nio.cs.ISO_8859_1;
+ import sun.nio.cs.US_ASCII;
+ import sun.nio.cs.UTF_8;
+
/**
* A file-based lines spliterator, leveraging a shared mapped byte buffer and
* associated file channel, covering lines of a file for character encodings
* where line feed characters can be easily identified from character encoded
* bytes.
*** 64,76 ****
final class FileChannelLinesSpliterator implements Spliterator<String> {
static final Set<String> SUPPORTED_CHARSET_NAMES;
static {
SUPPORTED_CHARSET_NAMES = new HashSet<>();
! SUPPORTED_CHARSET_NAMES.add(StandardCharsets.UTF_8.name());
! SUPPORTED_CHARSET_NAMES.add(StandardCharsets.ISO_8859_1.name());
! SUPPORTED_CHARSET_NAMES.add(StandardCharsets.US_ASCII.name());
}
private final FileChannel fc;
private final Charset cs;
private int index;
--- 67,79 ----
final class FileChannelLinesSpliterator implements Spliterator<String> {
static final Set<String> SUPPORTED_CHARSET_NAMES;
static {
SUPPORTED_CHARSET_NAMES = new HashSet<>();
! SUPPORTED_CHARSET_NAMES.add(UTF_8.INSTANCE.name());
! SUPPORTED_CHARSET_NAMES.add(ISO_8859_1.INSTANCE.name());
! SUPPORTED_CHARSET_NAMES.add(US_ASCII.INSTANCE.name());
}
private final FileChannel fc;
private final Charset cs;
private int index;
< prev index next >