DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2007
    Posts
    369

    How many bytes read using readFully()?

    I'm reading a DataInput.
    I have a variable number of bytes stored at the end of an input stream (may be in a file, may come from a socket, etc.).
    I need EOF to tell me when I reach the end AND I need the count of the actual number of bytes of data.

    This gets the data:

    Code:
    byte[] data = new byte[WAY_TOO_MANY_BYTES];
    try {
        in.readFully(data);
    } catch (EOF e) {
        // ignore
    }
    But I don't know how many bytes actually read. Can anyone think of a way to get the count, short of reading one byte at a time and counting them?

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,649
    See this discussion.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

Similar Threads

  1. Replies: 5
    Last Post: 05-27-2008, 11:17 AM
  2. Replies: 1
    Last Post: 01-11-2007, 03:14 AM
  3. Replies: 26
    Last Post: 08-09-2005, 01:11 AM
  4. How to read objects from file in a loop
    By mail2vinaybabu in forum Java
    Replies: 10
    Last Post: 02-27-2005, 01:07 PM
  5. Replies: 12
    Last Post: 05-18-2001, 04:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links