?
Solved

Peek a stream message in java

Posted on 2008-10-05
3
Medium Priority
?
811 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 1500 total points
ID: 22645226
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 22656578
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
ID: 22749893

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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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.
Suggested Courses
Course of the Month15 days, 22 hours left to enroll

850 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