當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。