當前位置: 首頁>>代碼示例>>Java>>正文


Java OutputStreamDataSource.close方法代碼示例

本文整理匯總了Java中org.globus.ftp.OutputStreamDataSource.close方法的典型用法代碼示例。如果您正苦於以下問題:Java OutputStreamDataSource.close方法的具體用法?Java OutputStreamDataSource.close怎麽用?Java OutputStreamDataSource.close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.globus.ftp.OutputStreamDataSource的用法示例。


在下文中一共展示了OutputStreamDataSource.close方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testCloseDataSourceSingle

import org.globus.ftp.OutputStreamDataSource; //導入方法依賴的package包/類
public void testCloseDataSourceSingle() throws Exception {

	OutputStreamDataSource sr = new OutputStreamDataSource(512);

	OutputStream out = sr.getOutputStream();
	out.write(1);
	out.flush();
	out.write(2);
	out.flush();
	out.write(3);
	out.flush();

	Buffer buf;

	buf = sr.read();
	assertTrue(buf != null);

	buf = sr.read();
	assertTrue(buf != null);

	sr.close();

	buf = sr.read();

	assertTrue(buf == null);
    }
 
開發者ID:NCIP,項目名稱:cagrid-general,代碼行數:27,代碼來源:OutputStreamDataSourceTest.java

示例2: testCloseDataSourceMulti

import org.globus.ftp.OutputStreamDataSource; //導入方法依賴的package包/類
public void testCloseDataSourceMulti() throws Exception {

	OutputStreamDataSource sr = new OutputStreamDataSource(512);

	Thread1 t = new Thread1(sr);
	t.start();

	// give the thread a chance to run
	Thread.sleep(2000);

	sr.close();

	assertEquals(null, t.getBuffer());
	assertEquals(null, t.getException());
	assertEquals(null, sr.read());
    }
 
開發者ID:NCIP,項目名稱:cagrid-general,代碼行數:17,代碼來源:OutputStreamDataSourceTest.java

示例3: testCloseDataSourceStream

import org.globus.ftp.OutputStreamDataSource; //導入方法依賴的package包/類
public void testCloseDataSourceStream() throws Exception {

	OutputStreamDataSource sr = new OutputStreamDataSource(512);
	
	OutputStream out = sr.getOutputStream();

	Thread2 t = new Thread2(out);
	t.start();

	// give the thread a chance to run
	Thread.sleep(2000);

	sr.close();

	assertTrue(t.getException1() == null);
	assertTrue(t.getException2() != null);
	assertTrue(t.getException2() instanceof EOFException);
	assertTrue(sr.read() == null);
    }
 
開發者ID:NCIP,項目名稱:cagrid-general,代碼行數:20,代碼來源:OutputStreamDataSourceTest.java


注:本文中的org.globus.ftp.OutputStreamDataSource.close方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。