当前位置: 首页>>代码示例>>Java>>正文


Java PrintStream.checkError方法代码示例

本文整理汇总了Java中java.io.PrintStream.checkError方法的典型用法代码示例。如果您正苦于以下问题:Java PrintStream.checkError方法的具体用法?Java PrintStream.checkError怎么用?Java PrintStream.checkError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.io.PrintStream的用法示例。


在下文中一共展示了PrintStream.checkError方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: copyBytes

import java.io.PrintStream; //导入方法依赖的package包/类
/**
 * Copies from one stream to another.
 * 
 * @param in
 *            InputStrem to read from
 * @param out
 *            OutputStream to write to
 * @param buffSize
 *            the size of the buffer
 */
public static void copyBytes(InputStream in, OutputStream out, int buffSize)
        throws IOException {
    PrintStream ps = out instanceof PrintStream ? (PrintStream) out : null;
    byte buf[] = new byte[buffSize];
    int bytesRead = in.read(buf);
    while (bytesRead >= 0) {
        out.write(buf, 0, bytesRead);
        if ((ps != null) && ps.checkError()) {
            throw new IOException("Unable to write to output stream.");
        }
        bytesRead = in.read(buf);
    }
}
 
开发者ID:maoling,项目名称:fuck_zookeeper,代码行数:24,代码来源:IOUtils.java

示例2: executeFTPCommand

import java.io.PrintStream; //导入方法依赖的package包/类
/**
* Sends a command to the FTP server.
* The command is sent through the command socket. A '\r\n' is placed at
* the end of the command.
* Here is a list of FTP commands:
*	<li>ABOR: abort a file transfer</li>
*	<li>CWD: change working directory</li>
*	<li>CDUP: CWD to the parent of the current directory</li>
*	<li>DELE: delete a remote file</li>
*	<li>LIST: list remote files (*)</li>
*	<li>MDTM: return the modification time of a file</li>
*	<li>MKD: make a remote directory</li>
*	<li>NLST: name list of remote directory</li>
*	<li>PASS: send password </li>
*	<li>PASV: enter passive mode</li>
*	<li>PORT: open a data port</li>
*	<li>PWD: print working directory </li>
*	<li>QUIT: terminate the connection</li>
*	<li>RETR: retrieve a remote file (*)</li>
*	<li>RMD: remove a remote directory</li>
*	<li>RNFR: rename from</li>
*	<li>RNTO: rename to</li>
*	<li>SITE: site-specific commands</li>
*	<li>SIZE: return the size of a file</li>
*	<li>STOR: store a file on the remote host (*)</li>
*	<li>TYPE: set transfer type</li>
*	<li>USER: send username</li>
* (*) Means that the response to the command is sent to the data socket. A data
* socket can be opened with the openFTPPassiveConnection method.
* @param command The command to send to the FTP server.
*/
private String executeFTPCommand(String command) throws IOException {
	final StringBuffer newLine = new StringBuffer("\r\n");
	StringBuffer commandLine = new StringBuffer(command);
	_lastCommand=command;

	PrintStream ps = new PrintStream(_commandOutput);
	commandLine.append(newLine);
	ps.print(commandLine);
	if(ps.checkError())
		throw new IOException();
	/*
	int n,nn;
	_lastCommand=command;
	nn=command.length();
	for(n=0;n<nn;n++) {
		byte b=(byte)command.charAt(n);
		_commandOutput.write(b);
	}
	_commandOutput.write('\n');
	*/
	return _commandInput.readLine();
}
 
开发者ID:costea7,项目名称:ChronoBike,代码行数:54,代码来源:FtpPassiveClient.java

示例3: checkError

import java.io.PrintStream; //导入方法依赖的package包/类
@Override
public boolean checkError() {
	
	for (PrintStream out : streams) {
		
		if (out.checkError()) { return true; }
	}
	
	return false;
}
 
开发者ID:Deconimus,项目名称:JarShrink,代码行数:11,代码来源:MultiPrintStream.java


注:本文中的java.io.PrintStream.checkError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。