Solved

Peek a stream message in java

Posted on 2008-10-05
3
789 Views
Last Modified: 2012-05-05
I need to peek a stream message to do some processing. This needs to be done before reading the whole message

I have the current code


inputStream = new BufferedInputStream(System.in, 1024);
 

FileOutputStream fos = new FileOutputStream(convTempFileName);
 

byte[] buf = new byte[256];
 

int read = 0;
 

while ((read = inputStream.read(buf)) > 0) {
 

// Here I need to dos omething when I see some particular element in the message
 

fos.write(buf, 0, read);
 

}
 

fos.close();

Open in new window

0
Comment
Question by:nirupamc
3 Comments
 
LVL 5

Accepted Solution

by:
libin_v earned 500 total points
Comment Utility
0
 
LVL 23

Expert Comment

by:Ajay-Singh
Comment Utility
have a question, before I suggest a solution, What is type of message? Java serialized object? or some other type
2.
0
 

Author Comment

by:nirupamc
Comment Utility

This is an xml message via a workflow which comes as a standard in to the program that I am working on
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This video teaches viewers about errors in exception handling.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now