URL buffer

Hello, how can I change default URL buffer size (before) when I create new URL. I have ie:fileURL = "file:..." orfileURL = "http:..." ...new URL(contextURL, fileURL)Regards,austy
[227 byte] By [austya] at [2007-11-27 3:22:12]
# 1
What's wrong with the current buffer size?
DrLaszloJamfa at 2007-7-12 8:24:58 > top of Java-index,Java Essentials,Java Programming...
# 2
I believe buffers(for file,...) have quite good size but I like to optimize speed of my application and I don't know when I write ie: new BufferedInputStream(url.openStream(), myBufferSize) then it will have an appropriate effect.austy
austya at 2007-7-12 8:24:58 > top of Java-index,Java Essentials,Java Programming...
# 3
buffer size ?the point is not about the URL,it's about the IO readingyou can get the inputStream after you create a URL,and read it with byte[ size ] , the size may the buffer size what you meanMessage was edited by: iamyess
iamyessa at 2007-7-12 8:24:58 > top of Java-index,Java Essentials,Java Programming...
# 4

If I open the URL and get input stream for file, then buffer size for file is 2kB and I need to change this size because of access to file. This concerns ftp, http, file,.... When I use read(new byte[size]) where size = 10kB then access to file will be 5... My problem is what happens is I use new BufferedInputSttream(..url stream.., 10kB). The access will be 1, speed slower because of 2 buffers.... ? I like to change URL buffer directly.

austy

austya at 2007-7-12 8:24:58 > top of Java-index,Java Essentials,Java Programming...
# 5

> If I open the URL and get input stream for file, then

> buffer size for file is 2kB and I need to change this

> size because of access to file. This concerns ftp,

> http, file,.... When I use read(new byte[size]) where

> size = 10kB then access to file will be 5... My

> problem is what happens is I use new

> BufferedInputSttream(..url stream.., 10kB). The

> access will be 1, speed slower because of 2

> buffers.... ? I like to change URL buffer directly.

>

> austy

you mean you need the strategy for many types ?

file,ftp,http

different type with different buffer size ?

I think URL without buffer size,so you should use some Design Pattern

such as wrape the URL / BufferedInputSttream ,or something...

iamyessa at 2007-7-12 8:24:58 > top of Java-index,Java Essentials,Java Programming...
# 6
Hello, and how can I set URL buffer without buffer size? And I try to wrap stream / buffer stream in the meantime but buffered stream doesn't force to read all bytes into inner buffer (i tried it for http). austy
austya at 2007-7-12 8:24:58 > top of Java-index,Java Essentials,Java Programming...
# 7

> If I open the URL and get input stream for file, then

> buffer size for file is 2kB and I need to change this

> size because of access to file. This concerns ftp,

> http, file,.... When I use read(new byte[size]) where

> size = 10kB then access to file will be 5... My

> problem is what happens is I use new

> BufferedInputSttream(..url stream.., 10kB). The

> access will be 1, speed slower because of 2

> buffers.... ? I like to change URL buffer directly.

>

This sounds like rubbish! Since you are going over a network you will almost certainly limited by network bandwidth and not by the number of buffer accesses you need. Stop trying to micro optimize your application until it is shown to be a problem.

sabre150a at 2007-7-12 8:24:58 > top of Java-index,Java Essentials,Java Programming...
# 8
Ok, I thought the url.openConnection().setUseCaches(..) and setDefaultUseCaches(..) helps. I like to drive all caches. It is posible at all?austy
austya at 2007-7-12 8:24:58 > top of Java-index,Java Essentials,Java Programming...
# 9
> I like to drive all> caches. Why?
sabre150a at 2007-7-12 8:24:58 > top of Java-index,Java Essentials,Java Programming...