English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i develop a program that encrypt video files ... and when i read it by "inputstream" it take much time ... i ask for simple code to read a video file the convert it to string

2007-07-02 00:07:05 · 1 answers · asked by Bemo 1 in Computers & Internet Programming & Design

1 answers

Try reading by BufferedInputStream, wrapped around the InputStream. That should speed it up significantly.

Instead of:

-------------------------
InputStream is = new FileInputStream('filename');
...
is.read()
...
is.close();
-------------------------

Use:

-------------------------
InputStream is = new FileInputStream('filename');
BufferedInputStream bis = new BufferedInputStream(is);
...
bis.read();
...
bis.close();
is.close();
-------------------------

Similarly, instead of just OutputStream to write, you should also wrap with a BufferedOutputStream.

2007-07-02 02:36:00 · answer #1 · answered by McFate 7 · 0 0

fedest.com, questions and answers