java - Reading bytes from a file -


i reading ".264" file using code below.

public static void main (string[] args) throws ioexception {      bufferedreader br = null;try {         string scurrentline;         br = new bufferedreader(new inputstreamreader(new fileinputstream("test.264"),"iso-8859-1"));         stringbuffer stringbuffer = new stringbuffer();         while ((scurrentline = br.readline()) != null) {             stringbuffer.append(scurrentline);               }         string tempdec = new string(asciitohex(stringbuffer.tostring()));         system.out.println(tempdec);         string asciiequivalent = hextoascii(tempdec);         bufferedwriter xx = new bufferedwriter(new outputstreamwriter(new fileoutputstream("c:/users/administrator/desktop/yuvplayer-2.3/video dinalized/testret.264"),"iso-8859-1"));         xx.write(asciiequivalent);         xx.close();     }catch (ioexception e) {         e.printstacktrace();     } {         try {             if (br != null)br.close();         } catch (ioexception ex) {             ex.printstacktrace();         }     }  } 

opening input , output file in hex editor show me missing values, e.g. 0d (see pictures attached).

any solution fix this?

image1 image2

lose inputstreamreader , bufferedreader, use fileinputstream on own.
no character encoding, no line endings, bytes.
javadoc page here, should need.

tip if want read entire file @ once: file.length(), in

file file = new file("test.264"); byte[] buf = new byte[(int)file.length()]; // use buf in inputstream.read() 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -