1 /* |
1 /* |
2 * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. |
2 * Copyright 2003-2009 Sun Microsystems, Inc. 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. Sun designates this |
7 * published by the Free Software Foundation. Sun designates this |
671 this((ReadableByteChannel)(new FileInputStream(source).getChannel()), |
672 this((ReadableByteChannel)(new FileInputStream(source).getChannel()), |
672 charsetName); |
673 charsetName); |
673 } |
674 } |
674 |
675 |
675 /** |
676 /** |
|
677 * {@note new} |
|
678 * Constructs a new <code>Scanner</code> that produces values scanned |
|
679 * from the specified file. Bytes from the file are converted into |
|
680 * characters using the underlying platform's |
|
681 * {@linkplain java.nio.charset.Charset#defaultCharset() default charset}. |
|
682 * |
|
683 * @param source |
|
684 * A file to be scanned |
|
685 * @throws IOException |
|
686 * if an I/O error occurs opening source |
|
687 * |
|
688 * @since 1.7 |
|
689 */ |
|
690 public Scanner(FileRef source) |
|
691 throws IOException |
|
692 { |
|
693 this(source.newByteChannel()); |
|
694 } |
|
695 |
|
696 /** |
|
697 * {@note new} |
|
698 * Constructs a new <code>Scanner</code> that produces values scanned |
|
699 * from the specified file. Bytes from the file are converted into |
|
700 * characters using the specified charset. |
|
701 * |
|
702 * @param source |
|
703 * A file to be scanned |
|
704 * @param charsetName |
|
705 * The encoding type used to convert bytes from the file |
|
706 * into characters to be scanned |
|
707 * @throws IOException |
|
708 * if an I/O error occurs opening source |
|
709 * @throws IllegalArgumentException |
|
710 * if the specified encoding is not found |
|
711 * @since 1.7 |
|
712 */ |
|
713 public Scanner(FileRef source, String charsetName) |
|
714 throws IOException |
|
715 { |
|
716 this(source.newByteChannel(), charsetName); |
|
717 } |
|
718 |
|
719 /** |
676 * Constructs a new <code>Scanner</code> that produces values scanned |
720 * Constructs a new <code>Scanner</code> that produces values scanned |
677 * from the specified string. |
721 * from the specified string. |
678 * |
722 * |
679 * @param source A string to scan |
723 * @param source A string to scan |
680 */ |
724 */ |