Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8796633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:40:04+00:00 2026-06-13T23:40:04+00:00

I needed to combine to inpustreams, which one has only string and the other

  • 0

I needed to combine to inpustreams, which one has only string and the other one is an avi file. I can easily combine two of them like below:

InputStream is = new SequenceInputStream(stringStream, aviStream);

However, when it comes to take the string and the avi separately, I am failing. The avi file does not match to its first size and somehow I am losing some size.

I can read is with a Scanner by using a delimiter, but in that case the avi stream will be String and i will lose information.

Any idea how can I separate the inputstream? I want to read back my string and i should have the rest of the stream as an inpustream.

EDIT: I am thinking of converting the stream to a byte array, then divide the array into two according to the delimiter. Then second part, which is the avi one, i can convert it back to an inputstream. But it seems to troublesome.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:40:05+00:00Added an answer on June 13, 2026 at 11:40 pm

    A Scanner is only for text data, not binary. Binary data e.g. AVI can contain every byte value which means there is no delimiter you can use which will not appear in the data.

    You can combine text with raw data in the following manner.

    DataOutputStream dos = new DataOutputStream(...);
    dos.writeUTF(string);
    dos.writeInt(bytes.length);
    dos.write(bytes);
    

    to reverse the process you can use DataInputStream with readUTF, readInt and readFully()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables, items and itemmeta. items has item_id which links it to
Is RadStyleSheetManager only for Telerik Controls CSS or can it be used to combine
I need to combine two mod_rewrite rules into one. 1) In CMS, there is
Needed to write a server text file as the output of a business process
I needed to change a work item field from PlainText -> String. As I
i needed help. How do i get domain from a string? For example: Hi
Possible Duplicate: Combine Multiple child rows into one row MYSQL I have following table,
How can I use MySQL to count with a LEFT JOIN? I have two
Let's say i have 3 byte arrays, each representin a .xls file. How can
I needed to combine maven war overlays with debugging Dynamic Web Application in Eclipse,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.