本文整理匯總了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);
}
示例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());
}
示例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);
}