Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DSDP - Mobile Tools for Java (MTJ) » Create a file in memory
Create a file in memory [message #24223] Sun, 21 December 2008 17:00 Go to next message
Eclipse User
Originally posted by: news.s237965939.online.de

I want to create a file stream in memory. In my case it's a midifile.
This file has a specified format. The header and other blocks have
variables of different types. A byte[] buffer is associated to the
class. My question now is how can I easily write my different variables
sequentially into the buffer? How will the headerChunk.write() function
look like? Here comes a little excerpt.

TIA,
Hans

public class MidiFile extends ByteArrayInputStream {
class headerChunk {
final byte[] Id = { 'M', 'T', 'h', 'd' };
final int Size = 6;
short Format = 0;
short NumTracks = 1;
short TimeDiv;

void write(....); ????
}
}
Re: Create a file in memory [message #24266 is a reply to message #24223] Mon, 22 December 2008 08:06 Go to previous messageGo to next message
David Marques is currently offline David Marques
Messages: 80
Registered: July 2009
Member
Hello Hans,

There are two classes that will help you, DataInputStream and
DataOutputStream. These classes let an application read primitive Java
data types from an underlying input stream in a machine-independent way.

Hope it helps you!

Regards,

David Marques
Re: Create a file in memory [message #24307 is a reply to message #24266] Tue, 23 December 2008 06:35 Go to previous messageGo to next message
Eclipse User
Originally posted by: news.s237965939.online.de

Hi David,

it's you again to give me tips. I've got it runnning now, not quite in a
manner which I hoped, but it works reliably.

Thanks and Merry Christmas,
Hans


David Marques wrote:
> Hello Hans,
>
> There are two classes that will help you, DataInputStream and
> DataOutputStream. These classes let an application read primitive Java
> data types from an underlying input stream in a machine-independent way.
>
> Hope it helps you!
>
> Regards,
>
> David Marques
>
Re: Create a file in memory [message #24348 is a reply to message #24307] Tue, 23 December 2008 07:26 Go to previous message
David Marques is currently offline David Marques
Messages: 80
Registered: July 2009
Member
Hi Hans,

It is always a pleasure to help MTJ users.

Merry Christmas for you too,

David Marques
Re: Create a file in memory [message #569312 is a reply to message #24223] Mon, 22 December 2008 08:06 Go to previous message
David Marques is currently offline David Marques
Messages: 80
Registered: July 2009
Member
Hello Hans,

There are two classes that will help you, DataInputStream and
DataOutputStream. These classes let an application read primitive Java
data types from an underlying input stream in a machine-independent way.

Hope it helps you!

Regards,

David Marques
Re: Create a file in memory [message #569348 is a reply to message #24266] Tue, 23 December 2008 06:35 Go to previous message
Eclipse User
Originally posted by: news.s237965939.online.de

Hi David,

it's you again to give me tips. I've got it runnning now, not quite in a
manner which I hoped, but it works reliably.

Thanks and Merry Christmas,
Hans


David Marques wrote:
> Hello Hans,
>
> There are two classes that will help you, DataInputStream and
> DataOutputStream. These classes let an application read primitive Java
> data types from an underlying input stream in a machine-independent way.
>
> Hope it helps you!
>
> Regards,
>
> David Marques
>
Re: Create a file in memory [message #569366 is a reply to message #24307] Tue, 23 December 2008 07:26 Go to previous message
David Marques is currently offline David Marques
Messages: 80
Registered: July 2009
Member
Hi Hans,

It is always a pleasure to help MTJ users.

Merry Christmas for you too,

David Marques
Previous Topic:Create a file in memory
Next Topic:MTJ 0.9.1 Available
Goto Forum:
  


Current Time: Sat Aug 30 14:45:10 EDT 2014

Powered by FUDForum. Page generated in 0.01923 seconds