?
Solved

Peek a stream message in java

Posted on 2008-10-05
3
Medium Priority
?
806 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month8 days, 14 hours left to enroll

764 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