• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 812
  • Last Modified:

Peek a stream message in java

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);

Open in new window

1 Solution
have a question, before I suggest a solution, What is type of message? Java serialized object? or some other type
nirupamcAuthor Commented:

This is an xml message via a workflow which comes as a standard in to the program that I am working on
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now