Read the contents of a file (via the)

Hello

I need to read the contents of a file (.txt, or better, .jpg) and write again in another file.

I have this code (in Javascript):

Conn = new Socket;

Conn.Encoding = "BINARY";

If (conn.open ("127.0.0.1:8888")) {}

Conn.Timeout = 30;

Conn.writeln (' GET variousFiles/file.jpg HTTP/1.1 "");

response = conn.read (999999);

Conn.Close ();

var file = new File("C:/APPS/New_File.txt");

leader. Encoding = "BINARY";

var open_file = file.open("w+");

leader. Write (Reply);

} else {alert ("error:" + conn2.error) ;}}

However my new file is always empty, because I can not read the contents of the first file.

My variable ""answer " is always empty. "

Thank you and best regards.

Hi Bob and Muppet,

below are my new code:

conn2 = new Socket;

If (conn2.open ('127.0.0.1:8888', 'BINARY')) {}

conn2. Timeout = 6000;

conn2. Write ("GET /Temp1/file.jpg HTTP/1.0\n\n");

reply2 = conn2.read (999999);

conn2. Close();

} else {alert ("Error:" + conn2.error) ;}}

This seems to work perfectly, I managed to read the jpg file.

Thank you

Tags: InDesign

Similar Questions

  • How to add do not read the option of the content inside the file adapter (playback synchronization) file

    Hello

    Is it possible, that I can jump to read the contents of the file within the file with the synchronous read operation adapter (I just want to read the file name and directory, and if the file name matches the input variables, then I remove the files, for this I am on FA with synch read operation) everything goes well as deletion but it reads the contents of the file and store it in the DB, I don't want).

    This will solve your problem.

    http://docs.Oracle.com/CD/E23943_01/integration.1111/e10231/adptr_file.htm#CHDHIEBI

    HTH.

    Puneet.

  • Hi there, I need to be able to read the raw files on an Olympus Stylus 1 via CS5 and Lightroom 4.  I downloaded Raw plugin v 6.7.1 file but still cannot read the files.

    Hi there, I need to be able to read the raw files on an Olympus Stylus 1 via CS5 and Lightroom 4.  I downloaded Raw plugin v 6.7.1 file but still cannot read the files?

    Read this http://helpx.adobe.com/creative-suite/kb/camera-raw-plug-supported-cameras.html table

    The Olympus Stylus 1 was first supported Camera 8.3 crude which is compatible with the CS6 and CC.

    It is not compatible with CS5 or more and never will be.

    If you do not upgrade to CS6 or CC, then you can dwonload the free Adobe DNG converter, convert all Stylus 1 Raw files to DNG, and then edit the DNG in CS5.

    Camera raw, DNG | Adobe Photoshop CC

  • Reading an XML file and write the content in another file xml in java

    Hello

    I'm new to xml parsing. My requirement is that I get a message (xml) using ibm MQ in the ByteArrayInputStream format. I read this xml message and write to another file.

    To do this, I create a CEP.

    First of all, I used simple reading and writing concept, but the output is "java.io.FileInputStream@3e25a5".
    Example of xml file
    -< customer >
    < > 1234 ClientId < / ClientId >
    STechnology < ClientName > < / ClientName >
    < DTU_ID > 567 < / DTU_ID >
    < ClientStatus > ACTIVE < / ClientStatus >
    -< LEAccount >
    < Customer > 678989 < / customer >
    < > 56743 LEId < / LEId >
    -< account >
    < AccountNumber > 9876543678 < / account number >
    < / account >
    < / LEAccount >
    -< Service >
    Y2Y < Cindicator > < / Cindicator >
    < PrefCode > 980 < / PrefCode >
    < BSCode > 876 < / BSCode >
    < MandatoryContent > MSP < / MandatoryContent >
    < / service >
    < / customer >

    Code:


    import java.io.ByteArrayInputStream;
    import java.io.FileInputStream;
    to import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;

    public class ByteArrayInputStreamToXml {}

    Public Shared Sub main (String [] GIS) throws IOException {}

    InputStream inputStream = new FileInputStream("C:\\soft\\test2\\sample1.xml");
    currentXMLBytes Byte = inputStream.toString () .getBytes ();
    ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream (currentXMLBytes);

    OutputStream out = new FileOutputStream("C:\\soft\\test\\data.xml");
    int read = 0;
    ubyte bytes [] = new byte [1024];

    While ((read = byteArrayInputStream.read (bytes))! = - 1) {}
    out. Write (bytes, 0, read);
    out. Write ("\n");
    }

    inputStream.close ();
    out. Flush();
    out. Close();

    System.out.println ("new file created!");

    }

    }

    Please suggest me how can I use DOM/SAX parser, I see several code on the net to read the xml file using SAX/DOM parser, but write an xml file after reading using ByteArrayInputStream I don't get. Assistance through some link examples will also be useful for me.

    Thank you
    Sumit

    Published by: user8687839 on April 30, 2012 02:37

    Published by: user8687839 on April 30, 2012 02:43

    user8687839 wrote:
    But the file is coming thanks to a queue and byte format. Must read the byte, and write to a file. So, how I tried to read the byte using the code above. Please suggest me the correct way.

    Simply write the bytes of the contents of the queue directly to a FileOutputStream. Still no need to SAX or DOM!

    Pseudo-code-

    Open a FileOutputStream .
    
    Until all the bytes of the queue have been read
        read some bytes from the queue.
        wite these bytes to the FileOutputStream.
    
    Close the FileOutputStream.
    

    Published by: sabre150 on April 30, 2012 11:30

  • Acrobat Pro read the content in the pdf file and turns?

    Acrobat Pro reads the content in the PDF and Fourier Transforms to xls files without need of a lot of changes or manual work?

    Acrobat X (Standard and Pro) will save tabular data in XLS or XLSX format, it can recognize the table as being a table. If the PDF file has missing or incorrect structure tags, Acrobat will try to guess the tabular presentation by the position of the text and lines on the page - this works well for basic formatting, but if the table has a complex style, spans cells etc. it can cause problems.

    Acrobat X will try to export a table in a scanned document, by applying the OCR during the stage of export - yet once this is based on the table identified visually.

    See http://www.adobe.com/products/acrobatpro/pdf-to-word-excel-converter.html and this article on how to extract an array of a larger document.

  • Is it possible to read the contents of the XML file rather than the properties for the location of FLEX

    Is it possible to read the contents of the XML file rather than the properties for the location of FLEX

    Strictly speaking, this is not really true. When running, the ResourceManager of IResourceBundles for localization, not deal with XML files or properties files. As long as you implement IResourceBundle, you can back it up with XML, properties, JSON, AMF files - what you want. The problem is that mxmlc will not build modules of resources for you what it is, with the exception of properties files, and cannot compile just resource bundles in a .swf using anything other than properties files. If you build your own interface to spit IResourceBundles, this could work, but it is probably more trouble that it's worth.

    (Assuming that you establish the link in the application) the best solution is to write a script to pre-process the XML in properties files.

  • Need expert help! CD player does not read the contents of the disc. Help!

    I searched and tried everything what we can imagine and impossible to find a solution. I can also restore because I don't really know this error at startup. Here are the symptoms and fixes I've tried. If there is someone out there who could help me it would be greatly appreciated!

    System:, I have XP w/SP3 installed. Dual-Core 3.0 G w / 3G P5N72T - MB Ram, HD 300 G, Asus CD/DVD Drive.

    Symptoms:

    • I had my CD player connected via PATA ribbon cable and my hard drive connected via a SATA cable.
    • My CD player will not autorun when an installation disc is installed.
    • My CD player will not read or display the contents of the disc when I use the file Explorer.
    • My letter of CD drive is D:\ and always appear as one of the discs.
    • When I use the command "run" and type: D:\install or D:\setup a windows "disk is not formatted" error appears stating "Windows is unable to read the disc. The disk might be corrupted or it could be in a form that is not compatible with windows.
    • My Green CD player will sweep on and I can hear it turn every time I try to explore the files or after I insert a disc, but she never autoruns, or displays content.
    • I decided to buy a new SATA CD drive and installed, unfortunately it does not work either exact problems remain.
    • I have two CD drives to another computer and they both work. So I know this isn't the disc or the lens.
    • I ran the utility Microsoft Fix It and she finds nothing wrong.
    • I ran the TweakUI to make safe autoplay features are on.
    • I did all the registry fixes proposed by microsoft and online forums. i.e. upper and lower, filters etc.
    • I removed the device from Device Manager and reinstalled.
    • I ran a virus, spyware, malware, and everything is clean.
    • I have the latest version of the system bios and all settings are fine. Most are on Auto that are associated with the detection.
    • Type of device DMA modes are selected in automatic detection.
    • If I could read a disc that I could try to reinstall windows XP, but it is not an option now until my CD player is fixed!
    • I don't have any installed like Nero buring CD software.
    • I actually installed Nero Light to see if it would read a disc, and of course I can see the disk and copy its content to my hard drive or take an image of the disk.
    • I tried to rename the drive, disconnect the drive.
    • I'm sure I tried other things, but can't remember right now!

    Thanks for your help in advance!
    Mike

    Hi msavage2000,

    It seems you have tried most of the steps to solve this problem. However, we would like to know if the drive does recognize the drive?

    As we know readers work, I would like you to try a new PATA/IDE cable and check the result.

    With regard to:

    Samhrutha G S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How to read the jad file property

    I am able to read the properties of the my application JAD file. My requirement is that through my application, I will download some other app via OTA, so is it possible to read the file property PPP through my application jad, I downloaded.

    you don't know. to download another app ota you need the address of the file jad online. with this you can download and analyze its contents.

  • How Business Service (file protocol) can read the location of the server XML file


    Hi Experts,

    I have a use case where I have to expose a Web service and as a response, I send a large xml (size max would be 18 MB).

    Customer <>- ProxyService (exposed as a Web service) <>- BusinessService (File protocol) < - read - > File.xml

    Here the xml response must be stored in the "SomeName.xml" file in the directory of the same server share path.

    So when the Client calls ProxyService, inturn would call it BS, where BS inturn would have read the contents of the xml file and pass it back as a response to the customer via PS

    Challenge is here using Protocol of file I can't do BS to read the xml file, instead his writing in a new file with conent as input message.

    Can someone let me know is it possible to read a xml file using business service.

    Note: I know that the PS can read a file using the Protocol of files, but my BS need use cases to read the contents of the file.

    Any quick response is more significant.

    Thank you

    Deba

    Cannot use the OSB in this case file adapter, you need to use a file in OSB JCA adapter. Specifically, what is called a 'synchronous reading' JCA adapter type file. Can be created in JDeveloper and then pulls in EPCO, can then be invoked as you want to extract the contents of a file synchronously in a proxy stream.

  • 25 Firefox is unable to read the configuration file on new install

    I try to install Firefox 25.0 on a XP - SP3 machine and receive the error "failed to read the Configuration file. Please contact your system administrator. I use a file to mozilla.cfg that I created and that you have applied to previous versions. The mozillia.cfg file has entries Pref lock, which are formatted as follows:

    lockPref ("Network.protocol - handler.external.shell", false);

    I have read discussions on various forums and the recommended fix seems to be a "clean reinstall. This machine has never installed Firefox, so a clean reinstall is not an option.

    As noted by one side this version of Firefox will be not to read the config on any OS file I tried Win7 or XP, I did a clean reinstall on both of these machines with the same results.

    I appreciate your help with this.

    If it helps, here is the content of my mozilla.cfg and local - settings.js.

    C:\Program Files\Mozilla Firefox\mozilla.cfg

    //
    
    lockPref("security.enable_ssl3", true);
    lockPref("security.default_personal_cert", "Ask Every Time");
    lockPref("network.protocol-handler.external.shell", false);
    lockPref("plugin.disable_full_page_plugin_for_types", "PDF, FDF, XFDF, LSL, LSO, LSS, IQY, RQY, XLK, XLS, XLT, POT PPS, PPT, DOS, DOT, WKS, BAT, PS, EPS, WCH, WCM, WBI, WB3, RTF");
    lockPref("browser.formfill.enable", false);
    lockPref("signon.autofillForms", false);
    lockPref("signon.rememberSignons", false);
    lockPref("dom.disable_window_open_feature.status", true);
    lockPref("dom.disable_window_move_resize", true);
    lockPref("security.enable_tls", true);
    lockPref("dom.disable_window_flip", true);
    lockPref("dom.event.contextmenu.enabled", false);
    lockPref("dom.disable_window_status_change", true);
    lockPref("dom.disable_window_open_feature.status", true);
    lockPref("browser.startup.homepage", "http://intentionally removed");
    lockPref("app.update.enable", false);
    lockPref("extensions.update.enabled", false);
    lockPref("browser.search.update", false);

    C:\Program Files\Mozilla Firefox\defaults\pref\local-settings.js

    pref("general.config.obscure_value", 0);
    pref("general.config.filename", "mozilla.cfg");
    
  • iTunes cannot read the contents of the iPod

    On a model MC540LL/A iPod running iOS 6.1.6 I get this alert:

    iTunes cannot read the contents of the iPod "IPod of Carl Carlson". Go to the summary in the iPod preferences tab and click on restore to restore the iPod to factory settings.

    There is no summary tab or the restoration.

    I have

    Restore all settings

    Erase content and settings

    along with several others that appear irrelevant.

    Which is appropriate?

    Thank you

    Connect your iPod to your computer and restore via iTunes

    Use iTunes on your Mac or PC to restore your iPhone, iPad or iPod settings - Apple Support

    You can then restore the backup:

    To restore backup see:

    Restore your device from an iCloud or iTunes backup - Apple Support

    https://support.Apple.com/en-us/HT204184

    If you restore from a backup of iCloud apps will be automatically downloaded. If you restore from backup iTunes, applications and music must be in iTunes since synchronized as music media library and apps are not included in the backup of the iOS device what iTunes does.

    You can re-download most of iTunes purchases by:

    Download after purchase from the App Store and iTunes Store iBookstore

    https://support.Apple.com/en-us/HT201272

  • I can't transfer file via airdrop between the macbook pro and my iphone 6.

    Hello world

    just bought a new macbook pro 2015 and I can't transfer file via airdrop between the macbook pro and my iphone 6.

    Can someone please help me solve this problem?

    Thank you

    < re-titled by host >

    First check the steps to run the drop:

    Use AirDrop to send the contents of your Mac - Apple Support

    There are some work around to try airdrop work:

    1. Turn off Bluetooth on your Mac.
    2. Delete /Library/Preferences/com.apple.Bluetooth.plist
    3. Re-turn on Bluetooth

    You can find more info here:

    Transfer and AirDrop does not work in El Capitan

    If you do not see all of your device, it means that you are affected by the same problem, I have known, since the upgrade to OS X the air drop of Captain does not work.

  • Can LabWindows libraries call function inherited from read the Datalog file?

    We are currently updating some old software written in LabVIEW 6.0.3 to Java. One of the features of the original software is to create data files using the function "Write Datalog" and also remind these databases later using 'Read Datalog'.  To maintain backward compatibility with old data users, we want that new software to also be able to read and display the old datalogs.  I have read several posts here about how the only way to get data off datalogs uses the function 'Reading Datalog' of the same version of LabVIEW to write the paper in the first place. I have the original LabVIEW code so I don't know the structure of the data that has been written.

    I want to know if there is the same function in LabWindows libraries.  Specifically is there is no support for a 6.0.3% version of the function of reading Datalog to support interfacing with a call to java?

    To knock out a possible solution, this software is shared with clients.  We want to avoid the way of compiling an executable separated from LabVIEW to be distributed with the main Java software which batch processes all the old data files in reading them with the old function of LabVIEW and spitting out files in a new format.  We would prefer for the old files to be transparent open into the new software.

    WARNING: I use LabVIEW for dark days before the invention of the button cancel, but never touched LabWindows/CVI. Please enter slowly so I will understand

    Thank you all!

    I guess that is not a built-in library capable of reading files datalog LabVIEW simply because they do not have a fixed format... Even in LV, you will need to pass the data structure for the opening function in order to be able to read the data back.

    Searching the forum I found this discussion that can give you useful to begin with.

    Apparently, you need detect the beginning of the section of the data file after the initials "DTLG" and rest of the header (which is the part not documented). After this point, read the file should be simple if you know the data structure the program writer used. The data > storage section of LabVIEW help can give you information about the content of the memory of each type of data used.

    A simple test, I did write the clusters with a string and an integer shows that: 1. section of data begins at offset 0x22F; 2. the cluster is poured into the file preceded an int with the length of the string; 3. documents may have a variable length according to the length of the string; 4. There are no bytes of padding between elements of the cluster; 5. records are packed in the file consecutively.

    I did this test using LabVIEW2009: it is possible that older files of LV are structured differently.

    An alternative to this is to generate a DLL in LabVIEW that reads files datalog and passes their content to the appellant. Since you are experienced in LV, you are certainly more comfortable than me by doing this.

  • Read the contents of a cell in an Excel sheet

    Hello

    In an Excel file, I have several sheets in one leaves (for example: Dispersion) I have a cell that is located in column 3 and line 5, this cell contains a value (for example, 500). So since a VI, how can I read the contents of this cell pour out the value 500?

    If I only have a map I can USE the function 'Reading worksheet File.vi' Pour lire into a txt format file, but here I have an Excel file with multiple sheets in there, how can I read a cell in a spreadsheet says? Thank you for your lighting. Good week end to you all.

    Hello, the privilege of this take a look on.

    http://zone.NI.com/DevZone/CDA/EPD/p/ID/3409

  • My wireless on my laptop will read the files on my desktop but I can't connect to the internet, my lapto electrician iI unless other computers work well

    My wireless on my laptop will read the files on my desktop but I can't connect to the internet, hard wire my laptop iI unless other computers work fine

    The following diagnostic information:

    1. Connect your laptop wireless so that you can "read the files on your desktop."
    2. Open a command prompt window (start > run > cmd > OK)
    3. Type the following command in the black command prompt window and press enter

      ipconfig/all > "% userprofile%\Desktop\testdata.txt".

    4. Let the window open orders and "hard wire" your laptop to connect to Internet
    5. Type the following commands in the black command prompt window and press ENTER after each one

      ipconfig/all > "% userprofile%\Desktop\testdata.txt".
      Notepad '% userprofile%\Desktop\testdata.txt '.

    6. Copy and paste the contents of the testdata.txt file into your answer here

    Please note that there are 2 for the second command ipconfig > characters.

    You can close and remove testdata.txt (which is located on your desktop) and close the command prompt window.

Maybe you are looking for