Linked Questions

75 votes
6 answers
175k views

Possible Duplicate: File to byte[] in Java I want to read data from file and unmarshal it to Parcel. In documentation it is not clear, that FileInputStream has method to read all its content. To ...
Arseniy's user avatar
  • 1,778
76 votes
9 answers
298k views

I want to convert an image to byte array and vice versa. Here, the user will enter the name of the image (.jpg) and program will read it from the file and will convert it to a byte array.
userv's user avatar
  • 2,627
-1 votes
2 answers
76k views

I am writing a Java program which encrypts a given text using RSA, and saves the encrypted bytes(byte[] array) in a .txt file. There is a separate decryption program which reads these bytes. Now I ...
daipayan's user avatar
  • 319
0 votes
1 answer
19k views

Need to load image to a byte[] variable. File file = new File(context.getFilesDir(), body + ".image"); BufferedReader in = new BufferedReader(new FileReader(file)); How can I convert BufferedReader ...
János's user avatar
  • 35.5k
0 votes
1 answer
6k views

So, I have this .mp4 video file which I would like to convert into bytes and send it to my client. At client, I'll receive all the bytes over RTP and then construct my own .mp4 file. Please help me ...
Spark's user avatar
  • 371
-1 votes
1 answer
6k views

I need to get the byte array from file path to upload the image. But the byte array in the form of array.How do i get the byte array. I have followed the following steps but could not found the ...
Rishikesh Rahi's user avatar
0 votes
2 answers
355 views

I need to load bytes from a file using Java. is this right ? InputStream ips=new FileInputStream(file); InputStreamReader ipsr=new InputStreamReader(ips); BufferedReader br=new BufferedReader(ipsr); ...
user avatar
-1 votes
1 answer
771 views

I am reading a large zip file but my code giving me negative array size exception // Simplest read of an entire file into a byte array // Will throw exceptions for file not found etc. ...
Aakash jain's user avatar
0 votes
0 answers
647 views

I have created a file called"output.txt" using this code snippet. public static void main(String args[]) throws IOException{ BitSet bitset = new BitSet(); for(int i = 0; i<100; i++){ ...
theprogrammer's user avatar
0 votes
1 answer
587 views

I am trying read a text file and insert those content into database. My file.length() is 3540 But the byte array is full of zeros. As a result when I open the text file, it is empty. File file = new ...
Santhosh SD Villivakam's user avatar
0 votes
1 answer
113 views

This is the code I am using that retrieves data from a letter.txt file File file = new File("/Users/Shiv/Eclipse/CPS3498/letter.txt"); FileReader fileReader = new FileReader(file); ...
Shiv's user avatar
  • 1
292 votes
9 answers
530k views

I am trying to read a simple text file into a String. Of course there is the usual way of getting the input stream and iterating with readLine() and reading contents into String. Having done this ...
Gopi's user avatar
  • 10.3k
130 votes
8 answers
210k views

Since the Android developers recommend to use the HttpURLConnection class, I was wondering if anyone can provide me with a good example on how to send a bitmap "file" (actually an in-memory stream) ...
Mihai Todor's user avatar
  • 8,364
87 votes
2 answers
185k views

I am using Spring MVC .I have to write a service that would take input from the request body, add the data to the pdf and returns the pdf file to the browser. The pdf document is generated using ...
Maheshwaran K's user avatar
47 votes
3 answers
28k views

I am trying out the new Gmail API and the samples use the classes in the java.nio.file package, e.i. Files and FileSystems. These classes was introduced in Java jdk 1.7 for the record, and since I am ...
Jakob Harteg's user avatar
  • 9,507

15 30 50 per page
1
2 3 4 5 6