import com.googlecode.sardine.*
sardine = SardineFactory.begin('username', 'password')
url = "http://localhost:8080/repository/default/SF.JPG"
if( sardine.exists(url) ){
is = sardine.getInputStream(url)
fos = new FileOutputStream("download.jpg")
buf = new byte[8192];
int rs = -1;
try
{
while( (rs = is.read(buf)) != -1 ){
fos.write(buf, 0, rs);
}
}
finally
{
fos.close();
is.close();
}
}
動作環境
groovy 1.7.4, JDK6 Update21, sardine-129
関連情報
- sardineのまとめ
- sardineのwebsite
http://code.google.com/p/sardine/
0 件のコメント:
コメントを投稿