File Channels versus File Streams

When should you use each one?

I need to get the file channels using java1.3 but FileInputStream.getChannel() is since 1.4, how can i get the work done using 1.3.You can't. The requirement is a contradiction in terms. Either you must use a FileChannel or you must use 1.3. There is no third choice.

Similar Messages

  • How can I read a binary file stream with many data type, as with AcqKnowledge physio binary data file?

    I would like to read in and write physiological data files which were saved by BioPac�s AcqKnowledge 3.8.1 software, in conjunction with their MP150 acquisition system. To start with, I�d like to write a converter from different physiodata file format into the AcqKnowledge binary file format for version 3.5 � 3.7 (including 3.7.3). It will allow us to read different file format into an analysis package which can only read in file written by AcqKnowledge version 3.5 � 3.7 (including 3.7.3).
    I attempted to write a reader following the Application Note AS156 entitled �AcqKnowledge File Format for PC with Windows� (see http://biopac.com/AppNotes/ app156Fi
    leFormat/FileFormat.htm ). Note the link for the Mac File format is very instructive too - it is presented in a different style and might make sense to some people with C library like look (http://biopac.com/AppNotes/ app155macffmt/macff.htm).
    I guess the problem I had was that I could not manage to read all the different byte data stream with File.vi. This is easy in C but I did not get very far in LabView 7.0. Also, I was a little unsure which LabView data types correspond to int, char , short, long, double, byte, RGB and Rect. And, since it is for PC I am also assuming the data to be written as �little endian� integer, and thus I also used byte swap vi.
    Two samples *.acq binary files are attach to this post to the list. Demo.acq is for version 3.7-3.7.2, while SCR_EKGtest1b.acq was recorded and saved with AcqKnowledge 3.8.1, which version number is 41.
    I would be grateful if you someone could explain how to handle such binary file stream with LabView and send an example to i
    llustrate it.
    Many thanks in advance for your help.
    Donat-Pierre
    Attachments:
    Demo.acq ‏248 KB
    SCR_EKG_test1b.acq ‏97 KB

    The reading of double is also straight forward : just use a dble float wired to the type cast node, after inverting the string (indian conversion).
    See the attached example.
    The measure of skin thickness is based on OCT (optical coherent tomography = interferometry) : an optical fiber system send and received light emitted to/back from the skin at a few centimeter distance. A profile of skin structure is then computed from the optical signal.
    CC
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    Read_AK_time_info.vi.zip ‏9 KB

  • How can I read a binary file stream with many data type, as with AcqKnowled​ge physio binary data file?

    I would like to read in and write physiological data which was saved by Biopac�s AcqKnowledge 3.8.1 software, in conjunction with their MP150 acquisition system. To start with, I�d like to write a converter from different physiodata file format into the AcqKnowledge binary file format for version 3.5 � 3.7 (including 3.7.3). It will allow us to read different file format into an analysis package which can only read in file written by AcqKnowledge version 3.5 � 3.7 (including 3.7.3).
    I attempted to write a reader following the Application Note AS156 entitled �AcqKnowledge File Format for PC with Windows� (see http://biopac.com/AppNotes/app156FileFormat/FileFo​rmat.h
    tm ). Note the link for the Mac File format is very instructive too - it is presented in a different style and might make sense to some people with C library like look (http://biopac.com/AppNotes/app155macffmt/macff.ht​m) .
    I guess the problem I had was that I could not manage to read all the different byte data stream with File.vi. This is easy in C but I did not get very far in LabView 7.0. Also, because it is for PC I am assuming the data to be written as �little endian� integer, and thus I also used byte swap vi.
    I would be grateful if you someone could explain how to handle such binary file stream with LabView and send an example to illustrate it.
    Many thanks in advance for your help.
    Donat-Pierre

    One more step...
    short are U16 integer
    double are double precision float
    bool seem to be 2 bytes (= U16)
    char are string (variable length)
    rgb are U16 integer, with high order byte = 0
    rect should be 4 x U16 (top, left, bottom, right)
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • SQL Server 2008 File Stream On Existing Table

    Hi Folks,
    I have enabled the SQL Server File Stream option on a Existing table.
    1. Created a GUID Column 
    2. Created a File Stream Column 
    3. Swapped the Blob Column information into file Stream column. 
    4. Dropped the BLOB Column. 
    I could evidence, The above Step 3 Process moved out all the Blob Data into an configured Network File Group.
    Ex:
    Existing BLOB Data Size --> 10 GB 
    Once after the completion of above step 4, SQL Server is not freeing up the BLOB occupied Space 10 GB. It should have only few MB's pointer address to the network file Group?
    If we create a new table with File Stream data type and insert the existing BLOB data ,Will result few MB pointer Address occupied in the newly created table. We except the similar behaviour for updating BLOB to File Stream in existing table. 
    Please advice me.
    Thanks 
    Narendran
    Narendran

    When you drop a column, SQL Server only mark the column as dropped, but does not reclaim the space, as that requires data to be shuffled around. You need to rebuild the clustered index (and any other index with the column) to reclaim the space. See repro
    below:
    CREATE TABLE myblobbie (id int   NOT NULL PRIMARY KEY,
                            name sysname  NOT NULL,
                            blob varchar(MAX) NOT NULL)
    go
    INSERT myblobbie(id, name, blob)
       SELECT object_id, name, replicate(convert(varchar(MAX), name), 1000)
       FROM   sys.objects
    go
    EXEC sp_spaceused myblobbie
    go
    ALTER TABLE myblobbie DROP COLUMN blob
    go
    EXEC sp_spaceused myblobbie
    go
    ALTER INDEX ALL ON myblobbie REBUILD
    go
    EXEC sp_spaceused myblobbie
    go
    DROP TABLE myblobbie
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Difference in File Adapter Read File as attachment and Use File streaming

    Hi all,
    As part of our POC we created a File adapter using the option Read file as attachment and File streaming we observed below things
    1.When we are taking “Attachment” option in file adapter, Its able to archive, but not supporting to write data to different location(using fileadapter’s write operation.)
    2.when WE are taking “ file streaming “ option in the adapter , Its not able to achive, but it writes data to different location(using fileadapter’s write operation.)
    Can anyone know is this is a correct behaviour . If yes what is the reason .
    Thanks
    Phani

    Hi all,
    As part of our POC we created a File adapter using the option Read file as attachment and File streaming we observed below things
    1.When we are taking “Attachment” option in file adapter, Its able to archive, but not supporting to write data to different location(using fileadapter’s write operation.)
    2.when WE are taking “ file streaming “ option in the adapter , Its not able to achive, but it writes data to different location(using fileadapter’s write operation.)
    Can anyone know is this is a correct behaviour . If yes what is the reason .
    Thanks
    Phani

  • File Streams *creating Files without those pesky line breaks

    Greetings Java Developers,
    Basicly I would like to write a large block of data out to a file without any line breaks and end of line characters that most JAVA Output Streams include with each call to WRITE(); First I am using BYTE Output Streams in JAVA and two end of line bytes are written also!!!
    It may be possible to use a Buffered File Stream with a Large Buffer about a Megabyte or so and FLUSH() the Stream all at once.
    Any ideas or suggestions will be greatly appreaciated!
    -chibi_neko

    I have not had a problem writing bytes to file. The getStream call returns a FileOutputStream. Also note that the curly braces around 'i' really are square braces but I used them because square braces around I get reformatted in his post.
          * Write bytes to a file.
          @param Data Data to write to a file.
          @param file Destination file.
         public static void write(byte [][] Data, File file)
              try
                   OutputStream out = getStream(file);
                   for(int i = 0 ; i < Data.length ; i++)
                        out.write(Data{i});
                   out.close();
              catch(IOException E)
                   throw new Error(E.getMessage());
              catch(Exception e)
                   throw new Error(e.getMessage());
         }the getStream method
    FileOutputStream fw = new FileOutputStream(file.getPath(),append);

  • Http adapter -reading a http file stream

    Hi folks,
    Here is a requirement
    I need to read a file sent as an http object stream through XI and then updated the same in a database table in R/3?
    <b>How can i configure the http adapter so that it reads the file stream</b>
    regards
    krishna
    Message was edited by:
            Krishnamoorthy Ramakrishnan

    Thanks bhavesh
    Though your reply and reference did not directly answer my question, which i will explain below concisely, it did help me to get an idea about how to handle my requirement.
    Please read and give me your valuable advise.
    The sender is a distributor that wants to send some text file to a file server in XI.The sender will have to send the file as a http stream link. XI has to read the  file from the http stream and push it to a  file server in XI.  for this, i have identified that
    1. At outbound/sender side, there is an HTTP adapter in XI.
    2.The request to XI should be of the some think like
    <b>http://<host>:<port>/file stream.....</b>
    3. At inbound side , I have a java server proxy as suggested in the blog.
    4. The server proxy will use a http client connection to read the file stream and another ftp client to push it to the file server
    Do you think this would realize the requirement?
    I have also got a question here
    With the above mentioned URL, will the sender be able to communicate with XI, since the client is outside the network and has access to internet only. How can it communicate with XI?
    Also, Is there an better alternative to this approach?
    Thanks for your help
    Kind Regards
    krishna

  • JAVA opening file streams q

    ok my question is how to:
    1. open file stream
    save something (system)
    ensure it gets written onto a disk
    close open files!
    thanks

    http://java.sun.com/docs/books/tutorial/essential/io/index.html

  • Fetching the file stream at check in

    Hi all,
    I'm interested in fetching the file stream when one does a check-in(web browser, DIS, etc), but I would like to do this at the earliest moment possible so that the temp file is not created i.e. the file should not reach the server. Does anyone has some viable solutions/ideas on how to do this. Another aspect would be how to make sure that everything that enters the CS is first intercepted by my code, disregarding the origin where the file is coming from(browser, DIS, Archiver etc.)
    Thanks,
    V

    Hi,
    use this function module GUI_FILE_SAVE_DIALOG.

  • Byte count for audio file stream

    I am using the following to determine the byte count of an audio file stream (for an iphone app):
    UInt32 bCount;
    UInt32 bSize = sizeof(bCount);
    err = AudioFileStreamGetProperty(inAudioFileStream, kAudioFileStreamProperty_AudioDataByteCount, &bSize, &bCount);
    if (err) { PRINTERROR("get kAudioFileStreamProperty_AudioDataByteCount"); } else {
    NSLog(@"************************%d", bCount);
    Unfortunately, most of the audio files I am accessing do not have this data available. Is there an alternate way I can determine this... I've tried NSFileManager, but I think that is just for the local file system, not mp3's out on the web... so it returns null...
    My intention is to implement a progressview, so I need the file length.

    check out
    https://devforums.apple.com/message/52205#52205

  • How can i transform a file stream into a stream of a block blob to download block blobs?

    I want to change this code to work with block blobs, but I can't seem to figure it out on my own
    // initialize the http content-disposition header to
    // indicate a file attachment with the default filename
    System.String disHeader = "Attachment; Filename=\"" + "sample.txt" +
    Response.AppendHeader("Content-Disposition", disHeader);
    // Download the blob to a file stream.
    using (FileStream fs = new FileStream(this.Server.MapPath(@"Data\data.txt"), FileMode.Open))
    int chunkSize = 4096;
    byte[] buffer = new byte[chunkSize];
    int read = 0;
    Response.AddHeader("Content-Length", fs.Length.ToString());
    do
    read = fs.Read(buffer, 0, chunkSize);
    Response.OutputStream.Write(buffer, 0, read);
    } while (read > 0);
    fs.Close();
    fs.Dispose();
    Response.End();

    Hi,
    What detailed scenario do you want to achieve? If you want to download files from block blob stream, please have a look at below article.
    #http://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-blobs/
    If I misunderstand, please feel free to let me know.
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • File Stream Open Problem with g++ 3.3.3 and libstdc++.so.5

    Hi
    I am facing one problem when I complie and run my code
    with the following compiler and standard C++ library :
    OS Used : SunOS GUILIN 5.8 Generic_108528-13 sun4u sparc SUNW,UltraAX-i2
    Compiler Used : g++ 3.3.3
    Standard Library Used : libstdc++.so.5
    Problem : I am supposed to create 1000 file streams,
    but when I run my program, it creates only 254 file streams,
    after that assertion occurs!!!!
    OUTPUT :
    ========
    $ echo $SHELL
    /usr/bin/sh
    $
    $ ulimit -n
    50000
    $
    $ ./a.out
    i : 253
    errno : 24
    Assertion failed: in, file main.cpp, line 28
    Abort - core dumped
    $
    ========
    MY CODE :
    ==================================================
    #include <sys/errno.h>
    #include <assert.h>
    #include <fstream>
    #include <iostream>
    #include <string>
    extern int errno;
    const int MAX_STREAM = 1000;
    using namespace std;
    int main(int argc, char* argv[])
    ifstream in[MAX_STREAM];
    string file("boo");
    for ( int i=0; i != MAX_STREAM; i++ )
    in[i].open(file.c_str());
    if ( errno > 0 ) {
    cout << "i : " << i << endl;
    cout << "errno : " << errno << endl;
    } // end of "if ( errno > 0 ) {"
    assert(in[i]);
    return 0;
    ===================================================
    But, if I compile the exactly same program with the
    following compiler and run the executable under the
    same environment as above, it is running without
    any problem and 1000 file streams are created
    smoothly without any assertion.
    OS Used : SunOS GUILIN 5.8 Generic_108528-13 sun4u sparc SUNW,UltraAX-i2
    Compiler Used : g++ 2.95.3
    Standard Library Used : libstdc++.so.2.10.0
    Anybody can help me to overcome this problem with
    g++ 3.3.3 compiler and libstdc++.so.5 library.
    With Very Best Regards
    Subrata Basak
    MediaRing Ltd., Singapore

    CVS differentiate text and binary files (they are marked as one or the other by using a CVS option when adding the file). If a file is marked as text, cvs will perform line-end conversion if needed.
    On Linux, line endings are coded as LF, whereas on Windows they're coded as CRLF. When you copied files from Windows to Linux, you probably did a binary copy, which left the CRLFs intact. When you checked those files into CVS on the Linux server, Linux CVS did not convert the CRLFs into LFs.
    The result of this is that if you check the files out on Linux, they will still contain CRLF (which is wrong for Linux). You may verify this by checking out a file on Linux, then opening it using vi -b. The CRs should show as extra ^M's at the end of each line.
    If, on the other hand, you check out the file on Windows, a conversion will take place, where all LFs are converted to CRLF. The result of this is that your file will contain CRCRLF at the end of each line.
    The best way to fix this is probably to check everything out on the Linux box, remove every CR from every file, then check everything back in again.

  • What channel can we stream on Apple Tv

    What channel can I stream on my Apple Tv 3rd Generation... I would buy it...
    And can we what channel like Cartoon Network??

    Keynote cannot currently be streamed to the Apple TV 2 with Airplay, however iOS5 is due to be released shortly which is slated to incorporate wireless mirroring to the Apple TV from an iPad 2, this will efectively mean that anything on your iPad display can be shown on your TV.
    Websites and third party Apps need enabling before they will allow AirPlay of Video content. Some Website/App developers have not enabled their products, some simply haven't got around to it yet, others have stated that they won't be enabling AirPlay (likely as a result of licensing issues).
    I have created a User Tip to list Apps that have been tested with Video Airplay, if you have any Apps that you have tested please leave details in the comments at the bottom of the User Tip or email me if you don't have commenting privelages.

  • Strange problem with RandomAcess FIle stream !!!!

    In our on going project we have a requirement of locking the files and do some processing on it.
    TO achieve this we used new features of JDK 1.4 and attained the locks. We are working on xml files and at present its size is around 390KB. After doing all activity when we try to write the file back to filesystem using 'RandomAccessFile' it does not write the full file. Next time it starts generating parsing errors.
    Due to this we are stuck up and donot know why this is happening. We tried doing the same with 'FileOutput'stream and it works fine. But our requirement is to do all the activity with RandomAccess only.
    Any help on the above will be highly appreciated.
    THanks in advance
    Arvind

    Below given is how I am reading the file
    raf = new RandomAccessFile("xfiles/lkups/analyser1.xml", "rws");
         if(raf!=null)
         channel = raf.getChannel();
         lock = channel.lock(); //Lock the file
         System.out.println("Got Lock !!");
    After doing the required processing on the file, the complete xml file resides in 'buffer' (stringBuffer). This is how I am writing it to the stream. (The same stuff works fine with FileOutputStream)
    raf.seek(0);
    ByteBuffer bBuff=ByteBuffer.wrap(buffer.toString().getBytes());
    channel.write(bBuff);
    channel.close();
    System.out.println(" read channel closed");
    raf.close();
    After lot of debugging this had been found that the problem is arising at the time of writing the file. The buffer contains the right parsable xml file.

  • Errors filling up daily.out file, streaming audio/vid problems, how to fix

    I've been experincing some seemingly random problems with my macbook
    1) Hard drive suspiciously full
    2) Cursor skipping around the screen when using the track pad, I finally disabled the pad and solely use an external wireless mouse. Occasionally when I turn the computer on the cursor will move around, but I'll be unable to select anything with the left click, right click still works, when I restart again the problem goes away. May or may not be related to other problems
    3) Recently have been having problems with streaming video/audio. The videos will load fine, but the audio will start skipping and soon the video will stop. This happens most noticeably with Netflix, which tells me I have an audio problem that requires that I reinstall my "audio card drivers." It also happens with video from vimeo, youtube, and other sources, regardless of whether I'm using Firefox or Safari. On the other hand, songs on itunes work fine. I check my download speed, which is actually above what I'm paying for. My google fu has failed me in determining what the actual problem is.
    Today I determined that the daily.out file is 19.6 gb, and when checking the log I found many many many repetitions of the following errors:
    "Fri May  4 15:02:00 House kernel[0] <Debug>: IOAudioStream\[0x57b5d00\]::clipIfNecessary() - Error: attempting to clip to a position more than one buffer ahead of last clip position (18,2c44)->(1a,1882)."
    Alternating with:
    "Fri May  4 14:34:37 House Firewall[62] <Info>: Deny Belkin Router Mo data in from 192.168.2.1:45563 to port 10111 proto=17"
    So, I'm thinking my huge daily.out file is related to my audio problems. Any ideas on what's up with my audio/firewall?
    Other common errors:
    Mon Apr 30 12:16:46 House com.apple.launchd[1] (com.google.keystone.daemon) <Warning>: Throttling respawn: Will start in 10 seconds
    Mon Apr 30 12:16:16 House com.apple.launchd.peruser.502[193] (com.macpaw.CleanMyMac.volumeWatcher[57563]) <Warning>: Exited with exit code: 1
    Mon Apr 30 12:12:29 House com.apple.launchd[1] (at.obdev.littlesnitchd[57493]) <Warning>: Exited with exit code: 1
    I know I can clear the daily.out file, but I'd like to address the problems filling it up so I don't have to keep emptying it. If I have to reinstall my OS, fine, but I'd rather not deal with it if I don't have to. Thanks so much for any ideas.

    I have a suspicion that the problem is not in the recording device itelf, but rather in the playback-software, which is struggling with an unfamiliar audio format/codec/whatever-it's-called... I opened the file in QuickTime Player 7 (7.6.6) and selected "Show Movie Properties" and it says:
    "Video Track: H.264
    Sound Track: Integer (Little Endian)"
    All current Mac systems support Integer (both Big and Little Endian) audio natively. The fact you can hear anything at all proves that the audio is playing back. The most likely problem would be a malfunction associated with the mic pickup.

Maybe you are looking for

  • How to send a plain text and HTML email at once?

    Hi all, I'm attempting to use cfmailpart to send a HTML and plain text email all in the same cfmail script.  I'm using Outlook and Gmail to test.  I temporarily changed my Outlook settings to "read all standard mail in plain text," but it does not re

  • 720p 60 fps slow motion

    I have a new helmet cam (Go Pro HD Hero). I have been playing around with the 5 formats for video. I did a 30 second shot with each of the 5 formats. FCP would not recognize 2 of the formats I tried to bring into Final Cut. The two formats are both o

  • Diverting messages from Telstra Pre-Paid 4G Connection Manager to a mobile number

    Hi, To find out how much credit i have left, I need to view the SMS alerts via my Telstra Pre-Paid 4G USB + WI-FIt Connection Manager, which is a pain. Does anyone know how (or think of a way) to divert messages sent to my prepaid broadband number to

  • Replace sentances and words directly in the FramMaker

    Hi! I want to replace complete sentances and words directly in the FramMaker where I keep the layout of my entire book. The program/the code I am looking for need to be able to replace many words and sentences at the same time. For example: <in such

  • How to create full new user with all privileges

    how to create full new user with all privileges? and how to delete existing users? Thanks in advance..