src/java.base/share/classes/sun/nio/cs/StreamDecoder.java
changeset 54569 7689e1cc56fe
parent 47216 71c04702a3d5
equal deleted inserted replaced
54568:b2ed96c35687 54569:7689e1cc56fe
     1 /*
     1 /*
     2  * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    26 /*
    26 /*
    27  */
    27  */
    28 
    28 
    29 package sun.nio.cs;
    29 package sun.nio.cs;
    30 
    30 
    31 import java.io.*;
    31 import java.io.FileInputStream;
    32 import java.nio.*;
    32 import java.io.IOException;
    33 import java.nio.channels.*;
    33 import java.io.InputStream;
    34 import java.nio.charset.*;
    34 import java.io.UnsupportedEncodingException;
       
    35 import java.io.Reader;
       
    36 import java.nio.ByteBuffer;
       
    37 import java.nio.CharBuffer;
       
    38 import java.nio.channels.FileChannel;
       
    39 import java.nio.channels.ReadableByteChannel;
       
    40 import java.nio.charset.Charset;
       
    41 import java.nio.charset.CharsetDecoder;
       
    42 import java.nio.charset.CoderResult;
       
    43 import java.nio.charset.CodingErrorAction;
       
    44 import java.nio.charset.IllegalCharsetNameException;
    35 
    45 
    36 public class StreamDecoder extends Reader
    46 public class StreamDecoder extends Reader
    37 {
    47 {
    38 
    48 
    39     private static final int MIN_BYTE_BUFFER_SIZE = 32;
    49     private static final int MIN_BYTE_BUFFER_SIZE = 32;
   188 
   198 
   189     public void close() throws IOException {
   199     public void close() throws IOException {
   190         synchronized (lock) {
   200         synchronized (lock) {
   191             if (closed)
   201             if (closed)
   192                 return;
   202                 return;
   193             implClose();
   203             try {
   194             closed = true;
   204                 implClose();
       
   205             } finally {
       
   206                 closed = true;
       
   207             }
   195         }
   208         }
   196     }
   209     }
   197 
   210 
   198     private boolean isOpen() {
   211     private boolean isOpen() {
   199         return !closed;
   212         return !closed;