File IO takeover - Virtual filesystem

How can you create an empty file, and when any program reads from the file, the content shuld come from somewhere else. And when any program writes to the file the bytes to be written goes some where else then to the disk.
I have been looking at java.nio.. + FileChannel but I don't know if this would even be posible.
Just to get started I would like to have a simple program that "graps" on to an empty file, sending anything written to the file (by other programs) to the system output stream, and not to the empty file.
My ide would be something like this :
FileChannel cha = new RandomAccessFile("file","rw").getChannel();
// map/redirect cha to MyFileChannel
class MyFileChannel extends FileChannel {
// overwride methods in FileChannel
public ... write(...) {
System.out.println(...);
Would this be posible ? Have I misunderstood the FileChannel ?

It is importent to me that the solution is platform
indepentent : works on Linux( standard
Ubuntu/Fedora/Nowell - desktop instalation ),
Windows, Mac, Solaris.
This remote directory shuld be
accesable throu the local file system, so that you
can do all the stuff that you can do on real local
files .Stating it again - impossible. Doesn't even matter what language you use.
You are describing something that it fundamentally basic to an OS. There are probably OSes that doen't have a file system but you are unlikely to ever see one. Educational courses in Operating Systems always cover the file system.
A file system depends on the hardware of the system. A device that uses a flash rom is completely different than a system that uses a hard driver. But even systems that use hard drives use different hardware and assumptions about the data that is on the hardware.
If you look at the specification for C/C++ you will find that although IO operations are supported it is at the stream and random access level. There are no disk management interfaces in the specifications.
Each OS has a different API to access the file system. And specifics of that varies by OS.
Perhaps if you altered your requirements to the file level (not byte read level) then you can manage files. Even with java. You simply delete a old file and rename a file with new data to have the name of the old file. Then the next request gets the new data.
Can I somehow create a fake usb-disk and controll the IO ? Is it possible to do what you are asking (with no restrictions)? Yes. You would have to write a lot of software for each specific targeted system (and version specific as well.) You will need to use C/C++ and you will have to learn a LOT about the internals of each OS. You will need to learn a lot about C/C++ as well.
The solution will be very platform dependent. I would suspect that most of the code will specific to each target.

Similar Messages

  • Using opendir()/readdir() with a virtual filesystem

    opendir() and readdir() work as expected when running on the real filesystem (compiling as a projector).  But don't seem to do anything when run on a virtual filesystem.  I can open files, but can't see them -- readdir() never lists any files.  Similarly, I can't seem to change the working directory to a directory in a VFS.
    Is this a known limitation, or am I missing something?  I can see that the VFS backend has the capbility to list files... is this not tied in to readdir()?  Is there some other way to read VFS directory contents from C?  (Ideally, without falling back to using interop code, though even an example of that might be nice.)
    I've tried this on both crossbridge 1.0.1 and the latest 1.1.0 devbuild, and have tried to search for answers on the subject but to no avail.

    Not sure then - maybe you can attach sample project with makefile and I can try poking around for a bit.
    In the meantime you can also consider using alternate approach, maybe generate XML file list each time you're creating your VFS which you'd then use for walking through files in your app.

  • Displaying files from a local filesystem not in Webserver Root

    I have been attempting to display a file from a local filesystem with no luck. Is there any way, with something like UTL_FILE, to read in a file (A pre-generated report from Funnel Web) and display it through a custom portlet? I have created a provider/portlet to use, however, I cannot seem to find the right combination of PL/SQL to accomplish this task. I am by no means a PL/SQL guru. Any suggestions would be welcome.
    Thanks.

    You can use URL component in the applications tab,for this purpose.
    (Create a URL component with URL pointing to ur local file system, which is under web server directory.)

  • What is the best way to compute the MD5 of a file from within a filesystem filter driver

    Greetings!
    I am developing a filesystem filter driver that monitors file creations. My driver is based on the sample code "scanner" in the DDK. I need to calculate the MD5 of the file in the PostCreate stage. I am using
    FltReadFile() to read the file where I have to read block by block - which I think is kinda inefficient. Is there a way to get the size of the file before I read ? That way I can allocate enough memory in advance and then read it in one shot.
    I don't see a FltXxxx function to read the size of the file. How do I do it ?? (Or if there is a another way to calculate MD5 that would work too)
    I also ran into another problem. For block by block reading, I use FltAllocatePoolAlignedWithTag/Free functions. I noticed that if I don't use the
    same exact variable to Free the block I get bsod. For example I allocate a block using a variable pBlock and then add it to an array of pointers. Later on I Free the blocks with array[index] - then I get the BSOD. The bug check code is BAD_POOL_HEADER.
    Any idea what is going on ? This is okay to do right ?
    Thanks
    ~B

    FltQueryInformationFile will get you the size information.  On the BSOD it is likely you are passing the wrong pointer back, give us a !analyze -v of the crash dump, so we can start the process of debugging.  Run your driver with "Driver Verifier"
    and enable special pool, to catch things.
    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

  • File exists in the filesystem [solved]

    I get this from today
    Targets: pacman-3.1.4-1
    Total Download Size:    0.00 MB
    Total Installed Size:   0.96 MB
    Proceed with installation? [Y/n] y
    checking package integrity...
    (1/1) checking for file conflicts                   [################################] 100%
    error: could not prepare transaction
    error: failed to commit transaction (conflicting files)
    pacman: /usr/lib/libalpm.so.2.3.1 exists in filesystem
    and also
    Targets: glib2-2.16.3-1  gnupg-1.4.9-1  libarchive-2.4.17-1  man-pages-2.79-1
             mkinitcpio-0.5.18.1-1  net-snmp-5.4.1-4  pacman-3.1.4-1  tzdata-2008b-1
    Total Download Size:    0.00 MB
    Total Installed Size:   13.55 MB
    Proceed with installation? [Y/n] y
    checking package integrity...
    (8/8) checking for file conflicts                   [################################] 100%
    error: could not prepare transaction
    error: failed to commit transaction (conflicting files)
    libarchive: /usr/lib/libarchive.so.2.4.17 exists in filesystem
    man-pages: /usr/share/man/man2/timerfd_create.2.gz exists in filesystem
    man-pages: /usr/share/man/man2/timerfd_gettime.2.gz exists in filesystem
    man-pages: /usr/share/man/man2/timerfd_settime.2.gz exists in filesystem
    man-pages: /usr/share/man/man3/eventfd_read.3.gz exists in filesystem
    man-pages: /usr/share/man/man3/eventfd_write.3.gz exists in filesystem
    pacman: /usr/lib/libalpm.so.2.3.1 exists in filesystem
    tzdata: /usr/share/zoneinfo/America/Argentina/San_Luis exists in filesystem
    tzdata: /usr/share/zoneinfo/posix/America/Argentina/San_Luis exists in filesystem
    tzdata: /usr/share/zoneinfo/right/America/Argentina/San_Luis exists in filesystem
    Errors occurred, no packages were upgraded.
    any clue???
    Last edited by Cippa Lippa (2008-04-23 17:34:11)

    Cippa Lippa wrote:it doesn't help... gives the same error... :-(
    Then you must have mistyped something, because the 'f' in 'pacman -Suf' tells pacman to ignore "conflicting files" error and just overwrite them.

  • Reading and processing file(s) in a filesystem

    I'm fairly new to java programming and need help.
    I need to write code which will and read and process 1 or many files from a filesystem. If a file is found, read and process it. Then do same for all files found.
    Please help.
    Thanks in advance!

    Some classes of the package java.io will be used .
    http://java.sun.com/j2se/1.4.1/docs/api/java/io/package-tree.html
    (The java.io.File has the methods list() and listFiles(), of which the former returns an array String[] and the latter returns an array java.io.File[]. )

  • Issue Bursting PDF file using delivery channel - filesystem

    I have an issue happening randomly with the files that are created by the bursting process in the filesystem path mentioned in the bursting control file.
    The PDF file that is the input to the Bursting process looks normal.
    However the splitted PDF file created by bursting in the filesystem is having the font all messed up.
    The input pdf file has multiple invoices. The issue is seen in one of the invoice that got bursted.
    Can anyone give me some input into the cause of this issue. should anything be changed in the bursting control file.
    <?xml version="1.0" encoding="UTF-8" ?>
    <xapi:requestset xmlns:xapi="http://xmlns.oracle.com/oxp/xapi">
    <xapi:globalData location="stream" />
    <xapi:request select="/ADP_OC_AR_INVOICE_PDF_PRINT_S/LIST_G_TRX_NUMBER/G_TRX_NUMBER">
    <xapi:delivery>
    <xapi:filesystem id="123" output="${URL}"/>
    </xapi:delivery>
    <xapi:document key="${TRX_NUMBER}" output-type="pdf" delivery="123">
    <xapi:template type="rtf" location="/otc/AR/in/fonts/XXX_INVOICE_PDF_PRINT.rtf" />
    </xapi:document>
    </xapi:request>
    </xapi:requestset>

    A few questions: Are you using an xsl-fo template or a RTF template? Doesn't location need to point to the complete path, including the template name? Is the path specified below in your post complete?
    Take a look at this: http://www.adivaconsulting.com/adiva-blog/item/9-bip-bursting
    Thanks!

  • Best practice to develop & keyword Jpeg files - Use of virtual copies

    There is no sidecar file attached to Jpeg file and I understand all modification on the Jpeg slightly deterioriate the file quality.
    Therefore, is it advisable to use vitual copies for all modifications?
    Would use use them for trial and errors procedure, then apply whatever settings retained to the Jpeg file?
    Or would it be better to leave the original Jpeg altogether untouched and stick to the virtual copy once modified?
    What about keywords applied at several stages before and after usig the develop module.
    Any advice would be much appreciated. Thanks in advance.

    Would you advise to store the metadata in  the file itself IN ADDITION to where they are located in the catalog?
    How to proceed?
    Would it make a difference in the export process?
    Storing metadata in the file itself is a good idea if you ever think you might share the photo with others, or with another application (other than Lightroom). And I think almost everyone will be doing one of these things at some point.
    You would want to turn on the option that automatically stores the metadata in xmp. Edit > Catalog Settings > Metadata, check the box that says Automatically Write Changes into XMP
    Would it make a difference in the export process? Probably unnoticeable fractions of a second.

  • (Urgent) How to read file properties with virtual path?

    I have the data.properties file, and write a servlet file to read properties from this properties file. But I get a problem, that is: I CANNOT USE VIRTUAL PATH!
    How can I solve?
    My Application Directory is,
    WEB-INF
    classes
    loadProperties.class
    data.properties
    More Question,
    I can use Context in Web.xml to assign values to parameters. But its will be shown. How can I hide value with a properties file?

    This is not working.
    I am using Tomcat 4.0.6, for my JSP application I am trying to read ini.properties file from \webapps\myapp\WEB-INF\classes\common\
    directory through java bean.
    System.getProperty("user.dir")
    is giving <tomcat-home>\bin directory.
    unless I hard code the path this way, I could couldn't read the ini file.
    Properties props = new Properties();
    String strIniFilePath = <webappPath> + "\\WEB-INF\\Classes\\Offenders\\Common\\";
    props.load( new FileInputStream(strPropsFile));

  • Oracle file handling in Virtual Environment

    Hi Gurus,
    We have a 9i environment, where file handling is being done till now.
    The client now got migrated to 10g, on a virtual environment.
    We are using external tables, and doing file operations (populating CSV files etc..) till now on 9i.
    I heard that the concept of files (directory paths) does not exist on the VDC(Virtual Data Center) environment.
    Can anyone clarify on this, why this can't happen, and if so what is the workaround for such cases.
    Thanks & Regards
    RK Veluvali

    I've never had such problems, but I've sure heard about them (or problems like them) a fair amount over the years.
    If you can report specific problems to Adobe here (1 problem per report), there is a chance it will do some good:
    Recently active topics in Photoshop Family about Photoshop Lightroom
    Note: one thing I realized way back is that I did not want to leave anything up to Lightroom (or chance), file-handling-wise, and so always assure my naming convention does not result in duplicate files. I NEVER want a -2 added to any of my files (ok, sometimes when testing, but otherwise: not). So anyway, to make a long story short, I recommend conventions and workflow which avoids the drama as much as possible.. - good luck (sorry I've not been more help..).
    Rob

  • Is OCS a real File system or Virtual file system?

    Hello gurus,
    I would like to ask pros some fundamental questions regarding OCS.
    1. Are files and folders in ocs are stored as real system files and directories in OS somewhere ?
    2. Are the files or folders all all maintained in database itself?
    We are trying to accomplish following task pertaining to document management: I dont know if we can achieve this through Oracle content services.
    We have bunch of documents that are attached to the Units ( Serialized) that we are selling.
    example
    1. SN1_A.doc ( sold from sales order 12345 and same documents referenced in Service request# A123)
    2.SN1_B.doc (sold from sales order 12345 and same documents referenced in Service request# A123)
    3. SN2_A.doc ( sold from sales order 12346 and referenced in SR# A124)
    4. SN2_B.doc ( sold from sales order 12346 and referenced in SR# A124)
    No we want two VIRTUAL directory views for Sales team and Service Team
    Virtual view for Service team:
    /Field Service/Service Requests/A123/ (will show SN1_A.doc and SN1_B.doc )
    /Field Service/Service Requests/A124/(will show SN2_A.doc and SN2_B.doc )
    Virtual view for Sales team:
    /Field Sales/Sales Orders/12345 / (will show SN1_A.doc and SN1_B.doc )
    /Field Sales/Sales Orders/12346 /(will show SN2_A.doc and SN2_B.doc )
    Is this possible in OCS? Is this possible in any Document Management product?
    Please help

    Hello,
    out of the box OCS content services won't do this for you -- at least not exactly.
    What you're looking for is a way to tag documents with metadata.
    For example, you would define a category called Sales and give it two attributes: sales order and service request.
    You create a folder which forces the user the populate these fields when uploading or checking in a document.
    A service technician could then use the content search facility (in the content browser) to look for documents with a service request of A123, while a salesman could search for documents tagged with the sales order 12345.
    This does not give you the virtual folder look that you seem to be after, so that would be the part you'd have to custom code. But you'd be using the search mechanism I described above.
    Regards,
    Ingo

  • CS5 save as CS4 makes Large File and sees virtual memory issue

    Two CS5 flash files. FileSource 27Mb  File Destination 21.8Mb
    They open in 80 seconds for each.
    FileSource has 15 MovieClips, 5 show areas of the map in a variety of colours, shape intensive one could say ! These are made into one movie clip and copy pasted to the FileDestination. In CS5 it then crashes.
    I turned these instead into CS4 files, they open in 10 seconds ! WOW !!!  I needed to adjust the text which had become two lines from one though.
    I try again for the CopyPaste of the movie Clip from library to library, this time I get a message Flash is out of  memory. To increase virtual memory, quit Flash and allocate more virtual memory in the Systems Properties dialog box.
    In there I see
    Initial   2046Mb
    Max size 4092Mb
    Recommended 4605Mb
    I alter this to:
    Initial  3800Mb
    Max    4600Mb
    Reboot PC (Win XP SP2 wih 4Gb ram, purpose built video editing suite) and try again, but again get the memory message. Such a powerful PC should handle Flash. PC at work also crashing with CS5.
    I thought I was winning with the quick handling of the files in CS4 but File size is now alarmingly FileSource  76.1Mb  and FileDestination 58.4Mb   WHY ? and why does it open them so quick but fall over on the copy paste ?
    CS4 opens these in 8 not 80 secs, but that save as CS4 has bloated their file size, quick to open but causing virtual memory failure. 
    I am defeated
    Does CS5 have some way of keeping size down ? I can’t use CS5 as it crashes when pasting the MovieClip from the source file to destination.
    Can I get Flash to simplify the layers perhaps ? There are many shapes of the same colour which perhaps could be fused into one, lessening the number of vector edges. How is that done ? I am making an swf file for a clients powerpoint slide show.
    Envirographics

    Possible good news. I've been away and hadn't opened DW since also having had a problem with Finder and external drives on my return. When I opened it today, and needed to do a 'Save As' , it did it with no problem of rendering. Though there have been no DW updates, there was updates to PS and ID. So I'll tentatively say the problem has gone away - hopefully for good.
    Just editing this post. I happened to turn  Live View on etc.. for the first time in a couple of weeks due to the  above. I realsied this morning I hadn't turned it on. Now it is just as  before when I try to 'Save As' - blank, an then have to close and reopen  for it to render (even though the Live View/Live Code is now stiched  off).
    No I don't know how to turn this thread back into an 'Unanswered' question.
    Message was edited by: tgiadd

  • How to upload the file in the virtual disk?

    I have created a virtual drive called Z.But I don't upload file(image).
    I could not find how to write the file path.
    <cfif len(attributes.background_file)>
    <cfset upload_folder =( ".....")">
      <cffile action = "upload"
        fileField = "background_file"
        destination = "#upload_folder#"
        nameConflict = "MakeUnique"
        mode="777">
      <cfset file_name = "#createUUID()#.#cffile.serverfileext#">
      <cffile action="rename" source="#upload_folder##cffile.serverfile#" destination="#upload_folder##file_name#">
    <cfif isdefined("attributes.old_background")>
      <cf_del_server_file output_file="settings/#attributes.old_background#" output_server="#attributes.old_background_server_id#">
    </cfif>
    </cfif>

    I adduce that my computer disk screen. if I want to upload file to virtual file system  Must I create a RAM disk-based file.Because all codes include ram://?
    http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSe9cbe5cf462523a0-70e2363b121825b20 e7-8000.html
    I aduce my computer disk screen. My virtual disk name is Z.Dou you have any idea abaut this subject.
    I apologize to anyone.

  • File locking in Virtual Office

    I'm using Virtual Office for Open Enterprise Server V 1.6.
    If a user working locally on my network opens a file the file will automatically be locked to read only for all other users. This is as it should be.
    If any other local users attempt to open the file they will recieve a standard warning message telling them that the file has been opened by somebody else, and who that person it.
    If a user working remotely via Virtual Office attempts to open the same file while it is locked in read only mode they do not receive any error warnign messages. Instead they just recieve a 404 File Not Found error.
    Is there any way to set up an automatic warning telling remote users with Virtual Office when a file that they are trying to access has is currently being edited by another user?

    KnaufIT,
    It appears that in the past few days you have not received a response to your
    posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Visit http://support.novell.com and search the knowledgebase and/or check all
    the other self support options and support programs available.
    - You could also try posting your message again. Make sure it is posted in the
    correct newsgroup. (http://forums.novell.com)
    Be sure to read the forum FAQ about what to expect in the way of responses:
    http://forums.novell.com/faq.php
    If this is a reply to a duplicate posting, please ignore and accept our apologies
    and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Product Support Forums Team
    http://support.novell.com/forums/

  • Making a Text File in Microsoft Virtual Studio Xaml App

    I'm trying to save kinect data to a text file, but first I'm trying to get any text file to start with. I have found a number of places that say to use:
         TextWriter tw = new StreamWriter("TestFile" + ".txt");
          tw.WriteLine("test");
          tw.Close();
    I have "using System.IO;" but I'm still getting errors
    Error 3
    'System.IO.TextWriter' does not contain a definition for 'Close' and no extension method 'Close' accepting a first argument of type 'System.IO.TextWriter' could be found (are you missing a using directive or an assembly reference?)
    C:\Users\Engineering\Documents\Visual Studio 2013\Projects\App1\App1\MainPage.xaml.cs
    164 10
    App1
    Error 1
    The best overloaded method match for 'System.IO.StreamWriter.StreamWriter(System.IO.Stream)' has some invalid arguments
    C:\Users\Engineering\Documents\Visual Studio 2013\Projects\App1\App1\MainPage.xaml.cs
    162 22
    App1
    Error 2
    Argument 1: cannot convert from 'string' to 'System.IO.Stream'
    C:\Users\Engineering\Documents\Visual Studio 2013\Projects\App1\App1\MainPage.xaml.cs
    162 39
    App1
    I think it has something to do with the fact that it's a xaml app or something, but don't know how to fix it. I don't want to remake my code in another type of app. If there is another way to save kinect data other than a text file then I'm all ears. 
    Thank you for your time.

    Hi Thardus,
    From your code snippet, I know that you are working with XAML application (Windows store app or windows phone store app). I would recommend you have a look at the following link to know how to write file to storage file.
    https://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh758325.aspx. They are different with desktop application.
    If you still have question, please post more information to clarify the type of project you are using.
    Regards,
    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.

Maybe you are looking for

  • Create Personal Documents Folder and iView to display

    Hi, I would like to 1. Create an KM Navigation iView to point to a users Fersonal Folder 2. Create an KM Upload iView to upload documents to a users Personal Folder These iviews should point to a users personal folder dynamically based on who is logg

  • Why is iTunes so frustrating and un-user friendly?

    Hi all, I switched from an android phone and table to the iPad and iPhone about 6 months ago and cannot believe how much easier to use they are. I've not had one single issue with Apple's hardware and honestly don't think I could live without my iPad

  • HT204053 set up icloud on my laptop running windows 7 .

    Hello all trying to set up icloud on my laptop running windows 7 and keep getting this error message and have been unable to fix could someone help. Error message cannot sign up This Apple ID is valid but is not an iCloud account.

  • How to include employee grade and step in a report

    If you navigate to People> Assignment>Others Grade Step. I can see the Grade and the Step. I would like to create a report that shows me the Basic salary for all staff and their grades and steps. please can some guide me with the query. appreciate al

  • Customer master details

    hello guru's,                 my requirment is i need to upload Customer Master details using BAPI  in LSMW. can anyone tell me the Business Object Type and Method name ..i know message type and idoc type for Customer Master bt i dont know how to sea