This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Java in General and the fly likes ByteArrayOutputStream size returns null. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "ByteArrayOutputStream size returns null." Watch "ByteArrayOutputStream size returns null." New topic
Author

ByteArrayOutputStream size returns null.

Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 588
I am writing to a ByteArrayOutputStream after every write I want to check how many bytes has been written.

So I call ByteArrayOutputStreams method size(), but instead of returning an int, it is returning a null pointer value.

Would be gald of any help in the correct way in calling the method size.

Thanks Tony
Manuel Moons
Ranch Hand

Joined: Mar 05, 2002
Posts: 229
Please show us your code. A method that returns an int can not return a null value. Are you sure that you initialized the ByteArrayOutputStream correctly?

Are you getting a nullpointer exception?
Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 588
Thanks for replying, I have a problem in that I cannot post the code.

I am using a wrapper that someone else has built. The Data is written to the ByteArrayOutputStream, which writes it to a Database Clob. That bit works.

Its just trying to return bytearraysize returns a null pointerexception.

Thanks for any help

Tony
Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 588
Found the problem, as I am writing to a database outputstraem, I am not using the ByteArrayOutputStream, so of course it will return a null pointer exception.

Tony
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: ByteArrayOutputStream size returns null.
 
jQuery in Action, 3rd edition