本文整理汇总了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);
}