java - Uploading Image using InputStreams = Out Of Memory error -


I'm trying to upload an image, but I'm getting something from memory errors if the image file is ~ 2 mega There is an Android device

  file file = new file (& lt; my image file & gt;); FileInputStream fis = New FileInputStream (file); HTTP Client Client = New HTTP Client (); PutMethod method = new purumath (myUrl); Request Entity Request Entity = New Interstitial Survey Entity (FIS); Method.setRequestEntity (requestEntity); Client.executeMethod (method);  

Exiting the memory error on the execute method method. How can I change the entire stream to read the memory and read the stream due to the accident?

Sample of HT DDS output:

  07 -27 10: 46: 24.334: debug / dalvikvm (26,576): 46 :: 24.374: 1196 objects in GC 6787 07-27 Oct. 522,592 bytes Debuts / dalvikvm (26,576): GC 33ms 07 freed 1738 objects / 196,752 bytes -27 10: 46: 24.374: information / dalvikvm-heap (26,576): 253,968-byte allocation Go to 5.184MB (frag case) for 07-27 October: 46: 24.414: Debug / dalvikvm (26,576): Gukie Freed 0 46: 24.464: in 45ms 7-27 October / 0 bytes items debug / dalvikvm (26,576) : Gucci Freed 3 items / 48ms October 7-27 122,992 bytes: 46: 24.474: info / dalvikvm-pile (26,576): Forward the heap (frag case) 516,112-byte to 5.558MB for October 07-27: 46: 24.524: debug / dalvikvm (26,576): 46 :: 24.574: Debug / dalvikvm Gkki Freed 0 items / 0 57ms 07-27 October bytes (26576): GC freed 3 objects / 254056 bytes into 46 mms 07-27 10: 46: 24.754: INO / DelWikiWM- Hep (26576): 1040400-byte extension for 6.308 MB ocation 07-27 October: 46: 24.824: debug / dalvikvm (26,576): 46 :: 24.894: info / dalvikvm-pile (26,576): heap (Frag case) Grow GC 3 items / 63ms 076,168 by October 516,168 bytes freed 2088976-byte 7.808MB for allocation 07-27 October: 46: 24.994: debug / dalvikvm (26,576): 46 :: 25.034: 101ms 07 in GC -27 Oct. 0 items free / debited debug / dalvikvm (26,576): 3 items in GC 34ms / 1040456 bytes were released 07-27 10: 46: 25.084: Information / Directional-Hep (26576): Hep ( Frag case), 4186128-byte allocation for 10808 MB 07-27 10: 46: 25.154: Debug / Dalvikvm (26576): 0 items in CC 63ms / 0 bytes free 07-27 10: 46: 25.434: Debuts / DelWikm (26576): GC has 3 items / 208 9 023 bytes in 58 mms 07-27 10: 46: 25.714: Information / Direlectiv-Hep (26576): 8380432-byte Increase the heap (tof case) to allot to 16.808 MB 07-27 10: 46: 25.784: Debuts / DelWikm (26576): 0 objects in GC 70 items and free 07-27 10: 46: 26.204: Debuts / DelWikm (26576): GC has 3 objects / 4186184 bytes 65 mile 07-27 10: 46: 26.204: freed in INO / Dalvikavam-Hep (26576): softrewer 16769040-byte  

for the distribution InputStreamRequestEntity without a length without this local The form is due to buffer data, so it can define a length. Since you place it as a file, use FileRequestEntity instead, as it will determine the size from the file.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -