| | |
Regarding byte arrays
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
Friends,
I am stuck here , I am downloading some files from a url uing GZIPInputStream.I need to store this files.So i declared a bytearray with specified length.As i am downloading files with different size, i think i need to declare a dynamic byte array.
Please help me to solve these issue.
Thank You
I am stuck here , I am downloading some files from a url uing GZIPInputStream.I need to store this files.So i declared a bytearray with specified length.As i am downloading files with different size, i think i need to declare a dynamic byte array.
Please help me to solve these issue.
Thank You
Show your code, so we can better understand what you're talking about. Generally speaking though, you do not need a "dynamic array", you need to use your "static array" properly.
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Maybe you need something like this:
java Syntax (Toggle Plain Text)
InputStream in = zipFile.getInputStream(); OutputStream out = new FileOutputStream(new File("a.bin")); byte buf[] = new byte[1024 * 8]; /* declare a 8kB buffer */ int len = -1; while((len = in.read(buf)) != -1) { out.write(buf, 0, len); }
I don't accept change; I don't deserve to live.
![]() |
Similar Threads
- C++ Byte arrays (C++)
- What relation does **indirection operator have with Multidimensional Arrays (C++)
- Pascal to VB (Pascal and Delphi)
- FTP Delivery Client (Pascal and Delphi)
- Where is System.Text.Encoding.EBCDIC? (C#)
- Multiple inputs for char / arrays of arrays (C++)
- Sorting arrays of pointers with function? (C)
- Comparing arrays (C++)
Other Threads in the Java Forum
- Previous Thread: Problem with line of source code,help please?
- Next Thread: threads
| Thread Tools | Search this Thread |
actuate android api applet application applications array arrays automation balls bank binary bluetooth business chat class classes clear client code codesnippet collections component coordinates database defaultmethod development dice dragging ebook eclipse educational error formatingtextintooltipjava fractal game givemetehcodez graphics gui hql html ide image infinite ingres input integer internet invokingapacheantprogrammatically j2me java javaprojects jni jpanel jtextarea julia linux list loop looping map method methods mobile mysql netbeans newbie openjavafx parameter php print problem program programming project recursion repositories scanner screen scrollbar server set size sms sort sorting sql sqlserver state storm string sun superclass swing swt text-file threads tree websites windows






