在groovy中将HttpInputStream插入OutputStream

在groovy中将HttpInputStream插入OutputStream,groovy,inputstream,outputstream,Groovy,Inputstream,Outputstream,如果Groovy和 IOUtils.copyLarge(content, output) 及 提前谢谢你的提示 假设您引用的是Apache的commons io库中的IOUtils,那么查看相应的源代码就会发现Apache的IOUtils.copyragle和Groovy的OutputStream.leftShift(我知道了,也就是),为了提高速度,我应该使用OutputStream.leftShift(这就是我所理解的)?对于HttpURLConnection和getContent()方法

如果Groovy和

IOUtils.copyLarge(content, output)


提前谢谢你的提示

假设您引用的是Apache的commons io库中的
IOUtils
,那么查看相应的源代码就会发现Apache的
IOUtils.copyragle
和Groovy的
OutputStream.leftShift
(我知道了,也就是
),为了提高速度,我应该使用OutputStream.leftShift(这就是我所理解的)?对于HttpURLConnection和getContent()方法,我可以取回一个字符串(这实际上会让我更容易)?也感谢验证类型的提示!
output << content
def connection = (HttpURLConnection)(new URL(myURL).openConnection())
def content = connection.getContent()
if (content instanceof HttpInputStream) {
    output << content
} else {
    // Handle error condition
}