Stream/Channel in memory; C# MemoryStream equivalent?

Alright, I've tried to do my homework before posting this question, so bear with me. I'm coming from more of a C++ and C# background... I've only been pecking away at Java for 2-3 months.
In C#, Stream is an abstract class inherited by MemoryStream, FileStream, and NetworkStream... maybe even some others, who knows. These Streams allow you to read/write data without any concern for allocation. Very cool.
I've explored java.io.* and java.nio.* and I haven't seen anything that seems to be the equivalent of C#'s MemoryStream. Everything seems to either be file-based or have a static capacity (which I get to declare, but still).
I'm working with C library that I've been JNI-ing for a while here and am now trying to allow the Java devs at my company to interface with the files it manipulates without using the disk. What I mean is that by default, the C library reads and writes based on ANSI paths, which is pretty standard. I'm trying to extend it by allowing them to work completely from memory. We do a lot of processing and if I can keep the disk out of the equation, our work will go that much more quickly.
To accomplish this, I'm going to let them pass me a ByteBuffer, or a Channel, or InputStream and OutputStream... or... see, that's where I get lost. Which one? Or some other? I originally started on ByteBuffer, until I realized that the capacity is solid once I create it. The C library needs to write data out sometimes, and if I run out of space in my ByteBuffer, what then? Allocate a new, larger ByteBuffer, copy the old into the new, and move on? Seems clunky. There has to be a better way. I figure I can't be the only person who has ever needed this kind of functionality.
Any guidance you can provide would be highly appreciated!

Have a look at ByteArrayInputStream and ByteArrayOutputStream for analogues to C#'s MemoryStream.
~

Similar Messages

  • BlazeDS with WAS 6.1 streaming channel killing the server?

    Hi,
    We are experiencing a strange issue with WAS (websphere server) 6.1 with BlazeDS
    after a while severe performance degrades and then system hungs shortly after
    Some prelimenary observations:
    we are seeing following errors in Server Log:
    [6/22/10 16:41:26:828 EDT] 000000b0 ThreadMonitor W   WSVR0605W: Thread "WebContainer : 3-in-streaming-mode" (0000002a) has been active for 656127 milliseconds and may be hung.  There is/are 1 thread(s) in total in the server that may be hung.
    [6/22/10 16:48:00:144 EDT] 000000b1 ThreadMonitor W   WSVR0605W: Thread "WebContainer : 0" (00000027) has been active for 753457 milliseconds and may be hung.  There is/are 2 thread(s) in total in the server that may be hung.
    We do see that there is always one active connection maintained betweeb browser and server(which is connected to ):
    messagebroker/streamingamf
    and  that keeps sending keep-alive signals , now is this a reason we are getting hung messages? can we safely ingore it?
    basically can streaming chanell cause that error? and what would be suggestions tweaks/modifications to fix that issue?
    our destination config :
    <destination id="alerts-Push-jms" >
            <properties>
                <jms>
                    <destination-type>Topic</destination-type>
                    <message-type>javax.jms.TextMessage</message-type>
                    <connection-factory>jms/***JMSTopicConnectionFactory</connection-factory>
                    <destination-jndi-name>jms/AlertEventingTopic</destination-jndi-name>
                    <delivery-mode>PERSISTENT</delivery-mode>
                    <message-priority>DEFAULT_PRIORITY</message-priority>
                    <preserve-jms-headers>"true"</preserve-jms-headers>
                    <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
                    <max-producers>1</max-producers>
                </jms>
            </properties>
            <adapter ref="jms" />
        <channels>
            <channel ref="my-streaming-amf" />
        </channels>
        </destination>

    Actually we did not fix it from WAS perspective, but what we did is ditched a blazeds streaming channel in favor of polling channel,
    that solved the issue.
    it appears that WAS has issues with connections that are Held open for a long time.

  • [svn] 1774: Bug: BLZ-176 - Not getting an authentication error when Producer tries to send a message over streaming channel with insufficient credentials .

    Revision: 1774
    Author: [email protected]
    Date: 2008-05-16 13:29:10 -0700 (Fri, 16 May 2008)
    Log Message:
    Bug: BLZ-176 - Not getting an authentication error when Producer tries to send a message over streaming channel with insufficient credentials.
    QA: Yes
    Doc: No
    Checkintests: Pass
    Details: This was caused by the fact that streaming channels do not report connected until the initial ping completes and a URLStream is established with the server. Added some extra code in ChannelSet to make sure authentication errors are reported with correct faultCode even if the channel is not reporting connected.
    Ticket Links:
    http://bugs.adobe.com/jira/browse/BLZ-176
    Modified Paths:
    flex/sdk/branches/3.0.1.x/frameworks/projects/rpc/src/mx/messaging/ChannelSet.as

    Revision: 1774
    Author: [email protected]
    Date: 2008-05-16 13:29:10 -0700 (Fri, 16 May 2008)
    Log Message:
    Bug: BLZ-176 - Not getting an authentication error when Producer tries to send a message over streaming channel with insufficient credentials.
    QA: Yes
    Doc: No
    Checkintests: Pass
    Details: This was caused by the fact that streaming channels do not report connected until the initial ping completes and a URLStream is established with the server. Added some extra code in ChannelSet to make sure authentication errors are reported with correct faultCode even if the channel is not reporting connected.
    Ticket Links:
    http://bugs.adobe.com/jira/browse/BLZ-176
    Modified Paths:
    flex/sdk/branches/3.0.1.x/frameworks/projects/rpc/src/mx/messaging/ChannelSet.as

  • No Packages for Streaming Channels only?

    I have FIOS Internet service only and have ditched the Verizon Router almost 2 years ago.  At the time, the provided routers did not provide Gigabit ports and the wireless was not great IMO.  I have no desire to reconnect this router or watch live TV on a regular basis.  Got rid of DirecTV and use Netflix and HuluPlus for TV content.  On the rare occasion I wanted to watch AMC for Walking Dead as it played live, I wanted to use the FIOS App on my XBox 360 and XBox One.  I was told I needed to subscribe to one of the full TV packages to get any of the streaming channels.  Maybe I'm the minority here, but feel Verizon is missing out on a subscriber base.
    Any ideas?

    WilliamIII wrote:
    I have FIOS Internet service only and have ditched the Verizon Router almost 2 years ago.  At the time, the provided routers did not provide Gigabit ports and the wireless was not great IMO.  I have no desire to reconnect this router or watch live TV on a regular basis.  Got rid of DirecTV and use Netflix and HuluPlus for TV content.  On the rare occasion I wanted to watch AMC for Walking Dead as it played live, I wanted to use the FIOS App on my XBox 360 and XBox One.  I was told I needed to subscribe to one of the full TV packages to get any of the streaming channels.  Maybe I'm the minority here, but feel Verizon is missing out on a subscriber base.
    Any ideas?
    A lot of your content providers with channels who offer streaming media through their websites or apps require a subscription from a cable provider, it's not just a Fios thing. Because of contracts with cable providers to carry the channels they aren't just going to allow you to watch their content without paying for some kind of subscription.
    Hulu, Netflix, etc. run their own paid subscription services which is why you can view their content however you want, but if you want to watch cable shows outside of those services that aren't on them, you are going to have to subscribe elsewhere.
    You can get local channel streaming such as ABC, CBS, etc. for free through their apps, but if it's a cable channel one way or another you're going to pay if you want what's offered.

  • [svn:bz-trunk] 14143: Should have happened long time ago but deprecated idle-timeout-minutes in Servlet-based streaming channels and introduced connection-idle-timeout-minutes .

    Revision: 14143
    Revision: 14143
    Author:   [email protected]
    Date:     2010-02-12 05:30:48 -0800 (Fri, 12 Feb 2010)
    Log Message:
    Should have happened long time ago but deprecated idle-timeout-minutes in Servlet-based streaming channels and introduced connection-idle-timeout-minutes. This way both Servlet-based and NIO-based channels have consistent timeout config.
    QA: No - I already tested.
    Doc: Yes - If we have references to idle-timeout-minutes in the doc, should be changed to connection-idle-timeout-minutes.
    Checkintests: Pass
    Modified Paths:
        blazeds/trunk/modules/core/src/flex/messaging/endpoints/BaseStreamingHTTPEndpoint.java
        blazeds/trunk/resources/config/services-config.xml

    ls -l /var/run/lighttpd/
    And how are you spawning the php instances? I don't see that in the daemons array anywhere.
    EDIT: It looks like the info in that page is no longer using pre-spawned instances, but lighttpd adaptive-spawn. The documentation has been made inconsistent it looks like.
    You will note that with pre-spawned information, the config looks different[1].
    You need to do one or the other, not both (eg. choose adaptive-spawn, or pre-spawn..not both).
    [1]: http://wiki.archlinux.org/index.php?tit … oldid=8051 "change"

  • Network stream fxp excess memory usage and poor performance

    I'm trying to stream some datas à highspeed rate (3 channels à 1Mbytes/s) from my 9030 to my windows host. Because i don't need to use data on the rt side, i choose to forward FXP <+-,24,5> to my host throug a network stream.
    To avoid data loose i choose to use a wide buffer of 6000000 with this buffer my memory usage grow from 441mo to 672Mo and my rio is unable to stream the data. 
    With sgl or double, memory usage is 441 to 491Mo and datas can be streamed continusly.
    Anyone have encoutered this problem?

    SQL Developer is java based and relies on the jvm's memory management.
    I'm not aware of any memory leaks as such, but memory tends not to be returned to the system.
    Queries which return large return sets tend to use a lot of memory (SQL Developer has to build a java table containing all the results for display).
    You can restrict the maximum memory allocated by modifying settings in in <sqldeveloper>\ide\bin\ide.conf
    The defaults are -
    AddVMOption -Xmx640M
    AddVMOption -Xms128M

  • Photo stream taking all memory.

    Even after deleting all photos and deactivating the photo stream, it is still taking up 6.1GB of memory on my phone. How do I fix this?

    The links below have instructions for deleting photos.
    iOS and iPod: Syncing photos using iTunes
    http://support.apple.com/kb/HT4236
    iPad Tip: How to Delete Photos from Your iPad in the Photos App
    http://ipadacademy.com/2011/08/ipad-tip-how-to-delete-photos-from-your-ipad-in-t he-photos-app
    Another Way to Quickly Delete Photos from Your iPad (Mac Only)
    http://ipadacademy.com/2011/09/another-way-to-quickly-delete-photos-from-your-ip ad-mac-only
    How to Delete Photos from iPad
    http://www.wondershare.com/apple-idevice/how-to-delete-photos-from-ipad.html
    How to: Batch Delete Photos on the iPad
    http://www.lifeisaprayer.com/blog/2010/how-batch-delete-photos-ipad
    (With iOS 5.1, use 2 fingers)
    How to Delete Photos from iCloud’s Photo Stream
    http://www.cultofmac.com/124235/how-to-delete-photos-from-iclouds-photo-stream/
     Cheers, Tom

  • Virtual Channel Device Memory

    I can calibrate a NI analog in DAQ card.  I calibrate it so that 1volt in is read at be 1.00000000000 in the software.  If I take that card to another computer it keeps that calibration information because it is stored in the card in EEPROM (or something).
    I was having a discussion with someone today and they asked the question.  Can Virtual Channels be stored in the device it a similar to calibration?  The answer (as far as I know) is no you can't, but is there a reason we can't?  I realize the non-volitile memory on the card may be small but is this a feature NI has ever thought about?  Seems like a good idea to have the option to bring along any scaling and channel information with the card to a new PC.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

    Hi Hoovahh,
    Yes you are right we cannot currently store virtual channels on a device but that is because they are a software configuration not a hardware configuration. It is an instruction that tells the drivers how to interpret the data being read off the buffer before it goes into LabVIEW. You can save tasks in MAX which contain scaling and channel information but you are right as of now we have no capability to save the virtual channel.
    Regards,
    Basil
    Applications Engineering
    National Instruments

  • Need help with Dual Channel DDR memory

    Hi, I have a msi nvidia MOBO, K7N2G and it supports dual channel memory. The manual says to put one in 1 and one in 3. I did then it wont start. System gives the old beep.........beep.........beep. I have to patriot 512 ddr sticks. They work fine in slot 1 and 2 but not in "dual channel" mode. Do i have to do anything else in order to get these to work?? Any assistance would be greatly appreciated. Thanks

    hi
    try slot 2&3.
    what brand of memory?
    what speed is the memory working in?
    there is no option to disable or enable dual channel.
    just put them in slot 1&3 or 2&3.
    bye

  • Unable to stream Channel 4 live

    This service is completely unwatcheable. Long pauses and regular message saying 'insufficient bandwidth'
    According to speedtest.net my connection has 32ms ping and 50M+ download speed.
    Using Chrome Version 25.0.1364.97 with no addons or ad blockers.
    Also when I go to the MyBT site, pages take 60-90 seconds to load.
    Apart from BT and Channel 4, everything else seems fine.
    Anyone got any ideas ?
    Thanks

    Others have reported Channel 4 buffering issues, you're not alone. MyBT can be slow from time to time. 

  • Anybody know the internal implemention of streaming channel in BlazeDS

    Client(localhost:4963) -> Server(localhost:8400)
    Server half close the connection between localhost:4963 and localhost:8400.
    Client(localhost:4964) -> Server(localhost:8400)
    Server pushs the message to client via the channel between localhost:4963 and
    localhost:8400.
    The above flow is from the sample(Publish/Subscribe Messaging (Data Push Use Case).
    My question is how to store the channel(4963 <- 8400) after half-closing it? Which code to handle it in the code base?
    Thank you

    Not really sure what you mean by "half-closing" and the question you're asking. Can you clarify?

  • Distributing 1 Stream (Channel) to 2 Destinations

    I want to distribute one stream to 2 destinations. For example the incoming flow from some Web Browser to the Web Server to be split to the Web Browser and Another user stream like "System.out".
    What is better way to do this:
    1. Using "java.io.*" classes or using "java.nio.*" classes;
    2. Using Pipe or standard way. If Pipe is better choice how to do that. I am not so familiar with Pipes.
    Can I find some working examples with similar functionallity?

    You can implement something like this :
    import java.io.*;
    public class DoubleStream extends InputStream {
      Vector outputs = new Vector(2);
      public DoubleStream(InputStream source) {
        super(source);
      public int read() throws IOException {
        int data = super.read();
        for(int i=outputs.size(); i-->0; )  ((OutputStream)outputs.get(i)).write(data);
        return data;
      public void addOutput(OutputStream os) {  outputs.add(os);  }
    }of course may be you will also need some exception handling, EOS handling etc... But this is like direction where to move on...

  • Memory on iPad 4 and Photo Stream

    I have an ipad 4 and it shows that I have 2.5 GB of pic's on it but there is nothing on my camera roll.  Does my photo stream take up memory on my actual device?

    Yes, a copy of the photo is downloaded to the device. It is generally a lower resolution copy depending on the device it is synced to.

  • Memory and dual channel problems

    Hi
    Can someone help me?
    1- I have 2x512 MB DDR 400 Twinmos CL 2.5 and amd xp 2600 (fsb 333) and Msi K7n2 delta L. I have tested separatly my sticks, one of them woks great, if i put dram clock at 166 or 200 the sytem is always stable. The other stick is not so great , if i put him at 200, most of times the sytem doesn´t boot and the lights  in the d-bracket display memory problems, when it manages to boot, when i get to windows i´m always getting blue screens with error messages. If i put to 166 it´s more stable, but sometimes hapens the same, but less frequently.
    I have run memtest, but it shows no errors in  both sticks.
    2- When i use both sticks together in dual channel dimm 1 & dimm 3 sometimes windows only displays 512 MB, but if i reboot the sytem, i get 1 GB as it should be.
    It is not frequently, but sometimes it hapens.
    3- How can i detect dual ddr is working or not?
    I´m asking this becouse the two sticks i have are similar, but there is a little diference, one of them has twinmos chips and the other has M.tec chips. But both are from Twinmos.  Sisoftware sandra shows them as equal.
    I have heard that this mobo, on the boot screen should display something like this:
    Memory Mode: Dual Channel
    or
    Memory Mode: Single Channel
    But in the boot screen it only says DDR 400 or DDR 333 acording to the setings i have put in the bios.
    My bios version is 5.1 (4/18/2003). Do you think i need to flash the bios?
    Thanks
    Pedro Cascão

    Sorry, i forgot to post my bios settings.
    CPU fsb clock 166 mhz
    cpu interface  normal
    fsb/dram ratio 1:1
    current dram clock 166 mhz
    memory timings:
    t (ras) 8
    t (rcd) 3
    t (rp)  3
    cas latency 2.5
    agp voltage 1.5 v
    dram voltage 2.7 v

  • HT4993 Do pictures in photo stream consume memory?

    I want to know if pictures stored in the photo stream consume phone memory

    If you mean content storage, yes.

Maybe you are looking for

  • I need to find a hard drive to stream films from not using the internet.

    I am looking to purchase a hard drive that my partner can watch movies from on his iPad, he is in the Navy so won't have internet or a router to go through, I did find one on PC world but wasn't sure if it would actually work or not. has anyone got a

  • Possible entries for selection screen field

    Hi, I have created a custom DDIC table Z_TAB which contains 3 fields of type char. The table contains about 100 rows of data. I want that at the selection screen, for each selection field a list of entries in the table should appear. E.g. Data rows:

  • Can Sims 3 be played on the MacBook Pro?

    I'm planning on getting the 13-inch MacBookPro. Will the Sims 3 work on my new computer?

  • Can we revert back a transport

    Hi, Recently we have imported a transport request in D environment which is given by SAP. As there are some errors we need to revert back that transport. We do not have option to retrieve the previous version in Version management. Because all object

  • About this mac storage display error (graph)

    The subject display indicates (in the graph) that there is 140 TB used for backup....the text numbers are correct. I reindexed the HD as suggested in another thread - no change. This is in the mildly annoying category - not a show stopper. Barry