An implementation of this using bufferedReader:

Posted apanda009

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了An implementation of this using bufferedReader:相关的知识,希望对你有一定的参考价值。

 

public class TextFile implements Iterable<String>{

        private BufferedReader br;

        public TextFile(String fileName) throws FileNotFoundException {
            br = new BufferedReader(new FileReader(fileName));
        }

        @Override
        public Iterator<String> iterator() {
                return new Iterator<String>() {
            @Override
            public boolean hasNext() {
                try {
                    br.mark(1);
                    if (br.read() < 0) {
                        return false;
                    }
                    br.reset();
                    return true;
                } catch (IOException e) {
                    return false;
                }
            }

            @Override
            public String next() {
                try {
                    return br.readLine();
                } catch (IOException e) {
                    return null;
                }
            }
            @Override
            public void remove() {
                throw new UnsupportedOperationException();
            }

        };
        }
}

  

以上是关于An implementation of this using bufferedReader:的主要内容,如果未能解决你的问题,请参考以下文章

Task of an Oracle Database Administrator

This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms whil

This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms

解决“This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms”(

c# 调用MD5CryptoServiceProvider出现 System.InvalidOperationException: This implementation is not part of

This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms whil