Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2005

Tip: Looking for answers? Try searching our database.

byte[] problem

Thread view: 
Geez - 15 May 2005 21:02 GMT
Hello all,

I created a descriptor which contains of two parts:
1: header: fixed length
2: field: variable length

The field part will contain a list of files. Now from 1 to 22 files i got no
problems.
But at 23 files i have problems sending the descriptor after i created it.

descriptor: (22 files)
- length byte[] header: 19
- length byte[] field: 479

descriptor: (23 files)
- length byte[] header: 19
- length byte[] field: 499

What can i have done wrong? Any advice?

Greetings

Geez
Boudewijn Dijkstra - 15 May 2005 22:24 GMT
> Hello all,
>
[quoted text clipped - 9 lines]
> - length byte[] header: 19
> - length byte[] field: 479

19 + 479 < 512

> descriptor: (23 files)
> - length byte[] header: 19
> - length byte[] field: 499

19 + 499 > 512

> What can i have done wrong? Any advice?

Flush the stream.
Geez - 16 May 2005 08:43 GMT
Hallo Boudewijn,

Thanks for your reply, but i don't understand it well in fact.
What's so special about 512?

Greetings

Geez
Boudewijn Dijkstra - 16 May 2005 12:08 GMT
> Hallo Boudewijn,
>
> Thanks for your reply, but i don't understand it well in fact.
> What's so special about 512?

The default buffer size for a BufferedInputStream or a BufferedOutputStream is
512 bytes.  A common mistake is forgetting that buffered streams don't
transfer their data immediately, but only in chunks of the buffer size or when
flushing it programmatically.
christopher@dailycrossword.com - 17 May 2005 03:12 GMT
You didn't really ask what's so special about 512, did you?  Gee,
that's like not knowing phones used to have rotary dials, hence "dial a
phone".  I'll bet you weren't alive when we landed on the moon, were
you . . .


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.