`
joeyhacker
  • 浏览: 94216 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

InputStream to File

阅读更多
oracle.sql.BLOB img_obj = (oracle.sql.BLOB) obj;
InputStream is = img_obj.getBinaryStream();
OutputStream os = new FileOutputStream(new File("new.jpg"));
int read = 0;
byte[] bytes = new byte[1024];
while((read = is.read(bytes))!= -1){
    os.write(bytes, 0, read);
}
is.close();
os.flush();
os.close();

 

分享到:
评论

相关推荐

    Java文件处理工具类--FileUtil

    * Write string content to local file using given character encoding. * * @param fileName - * local file name will write to * @param content * String text * @param encoding * the ...

    android 串口驱动

    /* Missing read/write permission, trying to chmod the file */ Process su; su = Runtime.getRuntime().exec("/system/bin/su"); /*String cmd = "chmod 777 " + device.getAbsolutePath() + "\n...

    一个Android文件下载Download程序示例

    一个Android文件下载Download程序示例,文件会下载至local端,远程安装程序(请输入URL),取得远程文件,取得URL,创建连接,InputStream 下载文件,创建临时文件,取得站存盘案路径,将文件写入暂存盘,在手机上打开文件的...

    Android代码-java-obj-to-opengl

    Java class that reads and converts a wavefront .obj 3d model file to java object. The result object will contain all the necessary data for render of the 3d model with OpenGL ES on for example Android...

    ym_java-YOYOPlayer-src

    * Open inputstream to play. */ public void open(InputStream inputStream) throws BasicPlayerException { log.info("open(" + inputStream + ")"); if (inputStream != null) { m_dataSource = ...

    服务器下载文件

    InputStream fis=new BufferedInputStream(new FileInputStream(path)); System.out.println("----当前路径----"+new File(".").getAbsolutePath()); byte[] buffer = new byte[fis.available()]; fis....

    delphi.fast.zlib.v.1.21

    average faster than native DLL distribution and 100% reliable (original test of zlib 1.1.4 version).How to compress and decompress a file:procedure TForm1.Button1Click(Sender: TObject);var InputStream...

    Objective-C序列化框架KryoCocoa.zip

    NSInputStream *inputStream = [NSInputStream inputStreamWithFileAtPath:@"file.bin"]; KryoInput *input = [[KryoInput alloc] initWithInput:inputStream]; SomeClass *someObject = [kryo ...

    servlet2.4doc

    Forwards a request from a servlet to another resource (servlet, JSP file, or HTML file) on the server. -------------------------------------------------------------------------------- G ...

    file_uploader:用于文件上传的简单 API。 在本地上传文件并上传到 S3

    文件上传器用于文件上传的简单 API。 将文件上传到本地和 S3。 为 DropWizard 量身定制。用法使用UploaderConfig类来配置 Uploader。 UploaderConfig config = new... upload(inputStream, " namespace " , " to " , "

    strust文件上传

    InputStream streamIn = file.getInputStream(); //创建读取用户上传文件的对象 //得到是字节数,即byte,我们可以直接用file.getFileSize(),也可以在创建读取对象时用streamIn.available(); // int ok=streamIn....

    轻量级语音分析

    This API allows developers to extract audio features and operate audio data like reading, cutting and trimming easily from an inputstream. It also provides tools for digital signal processing, renders...

    ganymed-ssh2-build210.jar java远程访问linux服务器操作、上传下载文件

    * To change this template use File | Settings | File Templates. */ public class ScpClient { //字符编码默认是utf-8 private static String DEFAULTCHART="UTF-8"; protected static org.apache.log4j....

    文件下载及web文件的contentType类型大全

    InputStream fis=new BufferedInputStream(new FileInputStream(filePath)); byte[] buffer=new byte[file.length()]; fis.read(buffer); fis.close(); //输出文件数据 toClient.write(buffer); toClient....

    Android实现复制Assets文件到SD卡

    Assets文件介绍 assets文件夹里面的文件都是保持原始的文件格式,需要用AssetManager以字节...3. 然后就是用已经open file 的inputStream读取文件,读取完成后记得inputStream.close() 。 4. 调用AssetManager.close

    hbase-fs-rest:用于 hbase-fs 的 HTTP REST API

    is a InputStream/OutputStream lib for reading & writing file on . It's not very convenient for end-user. So, we build a HTTP-REST Service to simplify the operation. Basically, we use HEAD, GET, PUT, ...

    图片上传并按比例缩小

    MemStream.WriteTo(Response.OutputStream); } } } </FONT></FONT></FONT><FONT color=#ff0000 size=4></FONT><FONT size=4>功能: 1。把图片文件(JPG GIF PNG)上传, 2。保存到指定的路径(在web.config中...

    c# 流断点上传

    int upLoadLength = Convert.ToInt32(HttpContext.Current.Request.InputStream.Length); string file = HttpContext.Current.Server.MapPath("/" + fileName); //string path = HttpContext.Current.Server....

    Android 加载asset文件夹下边的图片

    InputStream ims = getAssets().open(avatar.jpg); // load image as Drawable Drawable d = Drawable.createFromStream(ims, null); // set image to ImageView mImage.setImageDrawable(d); } ca

    MCCUtil 工具的使用

    InputStream is = new java.io.FileInputStream(file); props.load(is); is.close(); System.out.println("Successfully initialize MCC!"); }catch(Exception e){ IS_DISABLED = true; System....

Global site tag (gtag.js) - Google Analytics