`
wutao8818
  • 浏览: 616395 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

I/O from the Command Line

    博客分类:
  • io
阅读更多
http://java.sun.com/docs/books/tutorial/essential/io/cl.html

The Java platform supports this kind of interaction in two ways: through the Standard Streams and through the Console.

java平台支持2种控制台交互方式。1是通过标准的stream 另外一种就是 console

Standard Streams

InputStreamReader cin = new InputStreamReader(System.in);



The Console
http://java.sun.com/javase/6/docs/api/java/io/Console.html
Console流相对标准流来说是一个更高级的选项。Console类有大部分标准流提供的功能。另外它特别适合用户名密码这样的情况

why?

This method helps secure password entry in two ways. First, it suppresses echoing, so the password is not visible on the user's screen. Second, readPassword returns a character array, not a String, so the password can be overwritten, removing it from memory as soon as it is no longer needed.

char [] oldPassword = c.readPassword("Enter your old password: ");


System.console()

这个对象有可能返回一个null。原因是 not permitted / OS doesn't support them / or because the program was launched in a noninteractive environment.
分享到:
评论

相关推荐

    xz utils source code

    Emulation of command line tools of LZMA Utils eases transition from LZMA Utils to XZ Utils. While liblzma has a zlib-like API, liblzma doesn't include any file I/O functions. A separate I/O library ...

    Daniel Arbuckle's Mastering Python【含代码】

    You'll get ready to install, create packages, and run them on the command line. Throughout the journey, we'll highlight the major aspects of managing your Python development environment, show you how...

    OutlookAttachView v2.73

    o Added /SaveDirect command line option, for using with the other save command-line options (/scomma, /stab, /sxml, and so on...) When you use the SaveDirect mode, the attachments list is saved ...

    端口查看工具

    o When saving the opened ports from command-line, CurrPorts now uses the same columns order saved in the .cfg file. * Version 2.09: o Fixed bug from version 2.08: Some filters stopped working... ...

    UNIX环境高级编程(第二版,英文版)

    Line-at-a-Time I/O Section 5.8. Standard I/O Efficiency Section 5.9. Binary I/O Section 5.10. Positioning a Stream Section 5.11. Formatted I/O Section 5.12. Implementation ...

    BUS Hound

    It is possible for Commands to be overlapped at the I/O subsystem level (which Bus Hound displays), but not at the hardware level. <br>Multiple DI/DO phases <br>Windows 9x only: if multiple DI/...

    Practical C++ Programming C++编程实践

    File Input/Output C++ File I/O Conversion Routines Binary and ASCII Files The End-of-Line Puzzle Binary I/O Buffering Problems Unbuffered I/O Designing File Formats C-Style I/O Routines C-Style ...

    Turbo C 2.00[DISK]

    .DOC file on the COMMAND LINE/UTILITIES disk also answers many common Technical Support questions. TABLE OF CONTENTS ----------------- 1. How to Get Help 2. Installation 3. Important Notes 4. ...

    opengl编程基础源代码

    If you compile and link your code from a command line, then the following Makefile should work on most linux systems. Use the LDLIBS line that fits your X11 installation. C = gcc #LDLIBS = -lglut -...

    Turbo C 2.01[DISK]

    o If you used the INSTALL program to upgrade from version 1.5, or if you used CINSTXFR to transfer options from an installation of version 1.5, check the setting of the standard stack frame option...

    微软内部资料-SQL性能优化2

     Describe the effect on the I/O subsystem when memory runs low.  List at least two memory myths and why they are not true. Recommended Reading  SQL Server 7.0 Performance Tuning Technical ...

    Java邮件开发Fundamentals of the JavaMail API

    If you're viewing this document online, you can click any of the topics below to link directly to that section. 1. Tutorial tips 2 2. Introducing the JavaMail API 3 3. Reviewing related ...

    The Art of Assembly Language Programming

    Some Final Comments on the MOV Instructions <br>4.9 Laboratory ...The Command Window 4.9.5.6 The Output Menu Item 4.9.5.7 The CodeView Command Window 4.9.5.7.1 The Radix Command (N) 4.9....

    计算机网络第六版答案

    Hence, it becomes possible for the attacker to issue a command to all the nodes, that target a single node (for example, all nodes in the botnet might be commanded by the attacker to send a TCP SYN ...

    i-vector的工具箱

    String arguments, either for a file name or a numerical value, are useful when these tools are compiled and called from a shell command line. This makes it easy to use the tools on machines with ...

    2009 达内Unix学习笔记

    mv [-f] [-i] f1 ... fn d1 mv [-f] [-i] d1 d2 mv 源文件名 目标文件名 若目标文件名还没有,则是源文件重命名为目标文件;若目标文件已存在,则源文件覆盖目标文件。 mv 源文件名 目标目录 移动文件 mv 源目录...

    squashfs2.2-r2.tar.gz

    files/directories from the command line, the -ef option takes the exlude files/directories from the specified exclude file, one file/directory per line. If an exclude file/directory is absolute (i.e. ...

    BSD4.4设计手册.7z

    Generic system interfaces: the I/O, control, and multiplexing operations performed on descriptors The filesystem: files, directories, pathname translation, file locking, and I/O buffer management ...

    UE(官方下载)

    We are often asked if it is possible to run an UltraEdit macro or script on a file from the command line. The answer is yes - and it's not only possible, it's extremely simple! Using find/replace ...

Global site tag (gtag.js) - Google Analytics