Problem using PrintStream to write to file.

I am trying to write some String data to a file.
I have replaced System.out with a PrintStream of my own.
When I open the file with notepad,
there are little squared at the end of each line with text written.
I'm guessing they have something to do with
the default character encoding on a PrintStream Object.
I am aware that
"All characters printed by a PrintStream are converted into bytes using the platform's default character encoding".
as I am aware of the "java.nio.charset.Charset "
class. I have tryed specifying UTF-8 and US-ASII
encoding when instantiating a PrintStream Object.
What can I do to prevent the square being written, and just using default new lines
there, no matter how the file is viewed?
(my OS is Windows XP service pack 2)
?

Yes, I have. And yes, one would expect.
However, it isn't.
This is just personal code. I am doing the following:
import java.io.File;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import java.io.*;
public class DomParsing {
public static void main (String [] args)
try
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = builderFactory.newDocumentBuilder();
File file = new File("cd-catalog.xml");
Node child = null;
Document document = builder.parse(file);
Node element = (Node)document.getDocumentElement();
FileOutputStream fileStream = new FileOutputStream("SCREEN_OUTPUT.txt");
PrintStream logger = new PrintStream(fileStream,false);
System.setOut(logger);
iterate(element);
logger.close();
fileStream.close();
catch (Exception e)
{e.printStackTrace();}
//needs closer examination.
public static void iterate(Node element)
while(element instanceof Node)
peekNode(element);
peekAttributes(element);
Node [] children = getChildren(element);
if(children instanceof Node[])
//Node child = ;
iterate(children[0]);}
element = getSibling(element);
//Suspect may be either of those two instructions.
if(element instanceof Node)
//iterate(element);
continue;
private static Node [] getChildren(Node element)
Node [] children = null;
if(element.hasChildNodes())
NodeList nodes= element.getChildNodes();
children = new Node [nodes.getLength()];
for(int i=0;i<nodes.getLength();i++)
children[i] = nodes.item(i);
return children;}
private static Node getSibling(Node element)
Node sibling = element.getNextSibling();
return sibling;}
private static void peekNode(Node node)
if(node instanceof Node)
if(node.getNodeName()!=null && (!node.getNodeName().equals("#text")))
{System.out.println(new String(node.getNodeName()));
               System.out.println();
if(node.getNodeValue()!=null && (!node.getNodeValue().equals("#text")))
{System.out.println(new String(node.getNodeValue()));
               System.out.println();
private static void peekAttributes(Node element)
if(element.hasAttributes())
NamedNodeMap map = element.getAttributes();
for(int i=0;i<map.getLength();i++)
Attr attribute = (Attr)map.item(i);
peekNode((Node)attribute);}
//*******************************************************************************************************************

Similar Messages

  • I have been buying apps for a long time  without a problem using my credit card on file. All of a sudden itunes is not recognizing my card which is in good standing. All the info is correct but itunes/apple says it doesn't  match the bank info. Any ideas

    I have been buying apps for a long time  without a problem using my credit card on file. All of a sudden itunes is not recognizing my card which is in good standing. All the info is correct but itunes/apple says it doesn't  match the bank info. Any ideas?

    Answered in your Other post on this Topic...
    https://discussions.apple.com/message/24053626#24053626

  • How to use vn_rdwr() to write to file  in  a driver context?

    hi!
    i now am trying to write to file in a driver using vn_rdwr(),but
    it returns a value 0x1b ,i think the ioflag parameter is the
    reason for it ,so i kadb into ufs :wrip ,here (wrip) it return
    the 0x1b ,but it seemed the result is unrelationed to the ioflag.
    so what's the reason?
    if i do want to write in this way ,do i need to analysize
    the file system and vm every inch?

    Leaving behind the long discussion of DDI/DDK compliance of the thing
    (see it in old threads here and in Kernel - about half a year ago),
    I can tell you that the thing works for me... Still, wouldn't use it in driver (I have no choice in file system though).
    The return value of vn_* family seems to be the errno,
    so 0x1b == 27 == EFBIG...
    As for flags - see /usr/include/sys/vnode.h for appropiate enums.
    Once more - are you 100% sure you need your driver to write anything to file? There are conventional ways of driver-userland communication (notably, the ioctl() entry point)...
    Hope this helps...
    Sincerely,
    Ilya.
    P.S. You may be pretty sure that your driver won't work in the next version of Solaris if you'll use vn_* functions in it...

  • Problem using saxparser(reading japanese xml file)

    Hi everybody,
    I hav a problem while reading japanese xml file.(UTF-8 charset)
    I have to read the file and process it.
    But in the characters function of the saxparser(defaulthandler) the japanese chatracters are not read properly and the program is
    displaying some junk values(????) instead of the actual japanese characters.
    I am also usind xsd validation.
    I am not able to where the characters manipulation is being done.
    Please help me as soon as possible .
    Thanks in advance,
    Charan.

    There are a couple of things probably going on.
    1) When I've done things using Unicode unusual characters, they do not print properly if you do System.out.println( ). If you have a Gui panel and can put them into a JTextArea or JEditorPane, they may show up properly if you have set the font for that object to one that can display the characters.
    2) Many people starting with SAX write their code assuming that the characters method is only called once for each element that has text content. This is incorrect. The characters method can be called many times, and it is your responsibility to catch all of the data. In 1.4 you can use a StringBuffer, or in 1.5 there is a StringBuilder. You use these to accumulate the data from all of the calls to charactrers() between the startElement and endElement.
    Each parser can decide how often it calls characters, so you have to be able to process data from several calls.
    Dave Patterson

  • Problems using AVI read/write example

    I would like to test some vision processing software I wrote by reading an AVI file rather than a live stream. I found the "AVI read/write example" mentioned on this forum and it sounds like exactly what i need, but I cannot get it to read my avi files. When I run the example read VI, it says "An exception occured with the external code called by a call library node". Doing further testing, I found one AVI on my computer that would work, all others crash the VI. Another odd behavior is that the "avi init read" subvi will return the wrong frame rate for some AVIs. I have tried both compressed and uncompressed AVIs all in RGB format. I have also tried different frame rates and encoding options for my AVI file with no luck. I am just a stud
    ent, so buying software is not an option for me.
    Has anyone had problems reading AVIs with this? Are there AVI encoding options that will make this VI work?

    Hello,
    I think the avi functions that you get are VFW based, it can not read
    any format of compression codec. But it should be able to read
    uncompressed AVI files. But anyway, if you can't get IMAQ-vision 7.0
    avi functions to try (I don't have, I don't know how it works), you
    can always get my IVision to try out. In IVision, there are two groups
    of avi functions. One is called "AVI functions", they are VFW based,
    so not always work for all kind compressed avi files, but I have
    another group called "Media files", the functions there work for all
    format compressed AVI files, including mpeg, asf, avi... you can
    access the frame image by using a callback vi (example included), seek
    the media position, change play rate, etc.
    Go to get a download at:
    http://www.hytekautomatio
    n.com/Products/IVision.html
    Irene
    excube wrote in message news:<50650000000800000028B00000-1068850981000@exc​hange.ni.com>...
    > I would like to test some vision processing software I wrote by
    > reading an AVI file rather than a live stream. I found the "AVI
    > read/write example" mentioned on this forum and it sounds like exactly
    > what i need, but I cannot get it to read my avi files. When I run the
    > example read VI, it says "An exception occured with the external code
    > called by a call library node". Doing further testing, I found one AVI
    > on my computer that would work, all others crash the VI. Another odd
    > behavior is that the "avi init read" subvi will return the wrong frame
    > rate for some AVIs. I have tried both compressed and uncompressed AVIs
    > all in RGB format. I have also tried different frame rates and
    > encoding options for my AVI file with no luck. I am just a student, so
    > buying software is not an option for me.
    >
    > Has anyone had problems reading AVIs
    with this? Are there AVI encoding
    > options that will make this VI work?

  • Problem using Resource Bundle in XSLT File

    Hi All,
    I've been trying to use Resource Bundle on my XSLT file with no success for the last 2 weeks. So I would like some help to definitely end this problem.
    The fact is that i have a property file that i would like to read and it works fine when i use jsp or a servlet however when i try to call the same property file using my XSL i get the message below:
    java.util.MissingResourceException: Can't find bundle for base name thoth, locale en_US
    Follow the code from my Stylesheet that i'm calling the resource bundle:
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:java="java.util.ResourceBundle" exclude-result-prefixes="java" version="1.0">
    <xsl:strip-space elements="*"/>
    <xsl:output method="html" indent="yes" version="4.0"/>
    <xsl:output encoding="ISO-8859-1"/>
    <xsl:template match="page">
    <html>
    <body>
    <xsl:apply-templates select="paragraph"/>
    <xsl:variable name="resources" select="java:getBundle('thoth')"/>
    <xsl:value-of select="java:getString($resources,'general.title')"/>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>
    Please someone could help me why this file cannot be located, I am 100% of sure the property file path is in my classpath since it works fine in a servlet. Should i have to put it some other place? Do i have some other way to read this file and show the information from the file?
    I would appreciate any help
    thanks in advance and Regards
    Fabio

    Please someone could help me why this file cannot be located, I am 100% of sure the property file path is in my classpath since it works fine in a servlet.
    Is the property file in your classpath? or whether the directory where the property file is residing is in your classpath. Please put only the directory where the property file is located in the classpath and try again.
    It may be working fine with the servlet because j2ee servlet containers put the classes and lib directory automatically in the classpath therefore resource bundle gets loaded even without putting it explicitly in the classpath. This doesn't happen when you try to test some component from the console.
    Let me know if this does not work.
    regards,
    Abhishek.

  • Problem Using wlserver task in ant file

    I am trying to create a weblogic domain using the following in my ant file:
    <target name="new-server">
    <mkdir dir="/opt/deployment/domains" />
    <wlserver dir="/opt/deployment/domains"
    beahome="/opt/bea"
    domainname="SandboxDomain"
    servername="AdminServer"
    host="localhost" port="7001"
    generateConfig="true"
    username="weblogic" password="password"
    productionmodeenabled="false"
    action="start" failonerror="true" />
    </target>
    However, I keep getting the following exception:
    [wlserver] Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/Server
    I am executing the ant script by placing the weblogic.jar file in the lib directory of ant. I am also using ant version 1.6.2. Any suggestions on how to remedy this problem would be appreciated.

    Hi,
    Had the same problem, try adding the classpath attribute to the wlserver tasks.
    example:
    <wlserver dir="${SERVER_DOMAINS}/test_domain"
    beahome="${SERVER_ROOT}"
    weblogichome="${SERVER_WEBLOGIC_HOME}"
    generateConfig="true"
    host="localhost"
    port="6001"
    username="${WEBLOGIC_USER}"
    password="${WEBLOGIC_PASSWORD}"
    servername="testServer"
    action="start"
    classpath="<wl_installdir>\server\lib\weblogic.jar">
    Regards,

  • Problem using af:inputfile when only file name is given without path.URGENT

    Hai Friends,
    I am using input file type and <h:commandLink to upload a file. But when I type only the file name without the path like(hello.jpg) and try to submit then a javascript error occured "Access is denied". But my requirement is when i type without the path, that is only the file name i need to do some validations, like appending a global path with this file name and upload the file... the following is the code am having...
    <af:form id="address" usesUpload="true" >
    <af:inputFile id="id" value="#{BKb.batchFile}"/>
    <h:commandLink action="#{.uploadFile}">
    <h:outputText value="Upload" styleClass="buttonNoDecoration"/>
    </h:commandLink>
    <h:commandLink action="#{BKb.clearFile}">
    </h:commandLink>
    </af:form>
    can u help me in this issue...
    Thanks in advance,
    Ciya

    I figured out the problem, and it was caused by JHeadstart. I placed a default display value in JHeadstart for the download link. This caused a default values bean to be created by jheadstart and that bean was what was causing my problem. The download link had a display value, but not a valid path. I removed the default value, re-generated the screen and it is totally fixed. I have pretty much decided that it is never a good idea to use a default value in Jheadstart.
    Thanks for your help,
    Michelle

  • Problem Using XMLAnonymizerBean module in Reciever File adapter.

    Hi All,
                 I am trying to use the XMLAnonymizerBean in orer to convert the encoding of my xml document from UTF8 to ISO. However when I configure the module the message goes into waiting status  with an exception saying.
    Exception caught by adapter framework: Object not found in lookup of XMLAnonymizerBean..
    I have configured the Module in the below manner...
    Module Name = AF_Modules/XMLAnonymizerBean
    Module Type = Local Enterprise Bean
    Under Configuration i Mention
    anonymizer.encoding = ISO-8859-1.
    is there any thing i am missing, I am on Xi 7.0 SP 08.
    Please help...

    Thaks for the pointer. Now I dont get any error however  i am not getting the desired o/p.
    I am trying to change the header of an xml file which I am trying to write from <?xml version="1.0" encoding="utf-8"?>  to <?xml version="1.0" encoding="iso-8859-1"?> , as per the  help doc this could be changed using the xmlAnonymizerBean.
    My output still shows utf-8, Any pointers on thiswould be really appreciated.
    Thank you.

  • Problem using email to upload image files to Mobile Me gallery

    I will cross post this question to both Mail and Mobile Me discussion groups because I don't know where my problem lies.
    I have published a gallery page from iPhoto to my Mobile Me gallery. There are two ways to upload additional photos. I am not having trouble adding image files with the Upload feature. I cannot get the email function to work. The emails I send to the email address for the gallery bounce back to my mail inbox.
    Subject: Delivery Notification: Delivery has failed
    and in the body of the bounced email:
    Recipient address: [email protected]
    Reason: SMTP transmission failure has occurred
    Diagnostic code: smtp;521 5.2.1 Fatal failure of WOA
    Remote system: dns;post.mac.com (TCP|10.150.69.91|51195|10.13.19.27|25) (mbin002.mac.com ESMTP [2.3.3/gso-r197-19Feb2007] ready to rumble)
    Original-envelope-id: [email protected]
    Reporting-MTA: dns;asmtp028-bge351000 (tcp-daemon)
    Original-recipient: rfc822;[email protected]
    Final-recipient: rfc822;[email protected]
    Action: failed
    Status: 5.2.1 (SMTP transmission failure has occurred)
    Remote-MTA: dns;post.mac.com (TCP|10.150.69.91|51195|10.13.19.27|25)
    (mbin002.mac.com ESMTP [2.3.3/gso-r197-19Feb2007] ready to rumble)
    Diagnostic-code: smtp;521 5.2.1 Fatal failure of WOA
    One of the images I am trying to attach is a jpeg file of 61 kb.
    I have tried to drag the image from my desktop to the body of the email. I have tried using the "attach" function and selecting the file name. I am not sending any text with these files.
    When I built these albums, I checked and enabled all the options.
    I am having this same issue when I try to upload via email to any of my Mobile Me gallery pages.
    There is currently one photo displayed here:
    http://gallery.me.com/tplattenberger#100352
    If anyone wishes to try to upload to that gallery using email (Send to Album) that would be great and if successful, that might provide a clue to my problem.
    As I say, I currently have one photo there. If you find a lot more, please do not add.
    What's the problem?
    Tom

    The images I am trying are newly created and old.
    A weird hint perhaps...
    I just copied an image from Apple's home page and pasted it into the email and tried again...
    it worked.
    So I tried again, dragging from iPhoto and it did not work... the email bounced back.
    So I tried again, this time using copy and paste (like I did from Apple's page) from iPhoto... it did not work.
    Tom

  • Parse problem using SOMSchema reading an .xsd file

              Platform: windowsXP, WLI2.1, WLS6.1sp1
              The following is extracted from a log of the sample WLI server.
              I used it as a platform for an adapter under development.
              The log shows an erronous SOMSchema after a failed creation of an application
              view.
              The cause is long before. During a parse of a schema.xsd from a file into a SOMSchema
              it loses a '/'.
              <xsd:element name="Value">
              <xsd:complexType>
              <xsd:complexContent>
              <xsd:extension base="xsd:complexType">
              <xsd:attribute name="col" use="required"/>
              <xsd:attribute name="row" use="required"/>
              </xsd:extension>
              --> <xsd:complexContent/>
              </xsd:complexType>
              </xsd:element>
              Of course I worked around by dropping the tag </xsd:complexContent/>. Without
              all parses allright.
              From the erronous SOMSchema you can derive valid DocumentRecords.
              For that reason I guess the problem is to be found in the schema package.
              

              Platform: windowsXP, WLI2.1, WLS6.1sp1
              The following is extracted from a log of the sample WLI server.
              I used it as a platform for an adapter under development.
              The log shows an erronous SOMSchema after a failed creation of an application
              view.
              The cause is long before. During a parse of a schema.xsd from a file into a SOMSchema
              it loses a '/'.
              <xsd:element name="Value">
              <xsd:complexType>
              <xsd:complexContent>
              <xsd:extension base="xsd:complexType">
              <xsd:attribute name="col" use="required"/>
              <xsd:attribute name="row" use="required"/>
              </xsd:extension>
              --> <xsd:complexContent/>
              </xsd:complexType>
              </xsd:element>
              Of course I worked around by dropping the tag </xsd:complexContent/>. Without
              all parses allright.
              From the erronous SOMSchema you can derive valid DocumentRecords.
              For that reason I guess the problem is to be found in the schema package.
              

  • [Digester] Problem using recursion in xml rule file

    Hi!
    I am trying to parse an XML file using digester but getting a problem. The file has a recursive tag. The format of the file given below:
    <dpr-domain name="AircraftPerformances">
              <dpr-data-category name="AircraftClass" systemOption="FULLOLDI">
                   <dpr-attribute name="landingSpeed" systemOption="HALFOLDI"/>
                   <dpr-data-category name="holdingParameters" systemOption="HALFOLDI">
                        <dpr-attribute name="maximumspeed1" systemOption="FULLOLDI"/>
                   </dpr-data-category>
                   <dpr-data-category name="turnRate" systemOption="FULLOLDI,HALFOLDI">
                        <dpr-attribute name="maximumspeed2" systemOption="FULLOLDI"/>
                        <dpr-data-category name="accelerateRate" systemOption="HALFOLDI">
                             <dpr-attribute name="maximumspeed21" systemOption="FULLOLDI"/>
                             <dpr-data-category name="descendRate" systemOption="HALFOLDI">
                                  <dpr-attribute name="maximumspeed211" systemOption="FULLOLDI"/>
                             </dpr-data-category>
                        </dpr-data-category>
                   </dpr-data-category>
              </dpr-data-category>
    </dpr-domain>
    The rule file I have written for this is:
    <digester-rules>
         <pattern value="dpr-domain">
         <object-create-rule classname="check.Domain"/>
              <pattern value="*/dpr-data-category">
                   <object-create-rule classname="check.DataCategory"/>
                   <set-properties-rule/>
                   <pattern value="dpr-attribute">
                        <object-create-rule classname="check.Attribute"/>
                        <set-properties-rule/>
                        <set-next-rule methodname="addAttributes" />
                   </pattern>
                   <set-next-rule methodname="addDataCategory" paramtype="check.DataCategory"/>          
              </pattern>
              </pattern>     
    </digester-rules>
    But this is not working. If the "dpr-domain" tag is removed, then it works. Please help me by giving a solution for this problem.
    Regards,
    Arshika

    For this scenario,
    First I have used FCC for the same structure and CSV is also generated, but the CSV when opened with NOTEPAD it is not showing endSeparator , i.e my first row last element is concatenated with second row first element,there is no row seperator.
    But the same when opened with WordPad,we can see the data, row wise
    now the destination system open the file in notepad only.
    for that i tried using this Bean specified above but it is not fulfilling the requirement.
    The parameters I have mentioned in FCC are as follows:
    Recordset Structure : E1WBB01,E1WBB03,EAN_MASTER
    NAME                                      VALUE
    EAN_MASTER.fieldSeparator     ,   (comma)
    EAN_MASTER.endSeparator     'nl'
    E1WBB03.fieldSeparator            ,
    E1WBB03.endSeparator             'nl'
    E1WBB01.fieldSeparator            ,
    E1WBB01.endSeparator             'nl'
    Please provide a solution,why thr endSeparator is not shown in notepad.
    Thanks

  • Problem using Automator to back up files

    I've tried several times to set Automator up to help me back up files, but each time, the workflow only goes through part of the task before Automator shuts down unexpectedly.
    Here's what I'm doing:
    1. I set Find Finder Items to find files, etc. (using my hard drive as the search location) modified after a certain date (when I last backed up my files).
    2. I followed that with Copy Finder Items.
    3. The third step was Move Finder Items (the copies) to the desktop.
    4. The last was a new folder the copies were supposed to be moved into.
    (I want to make sure I get all my new/modified files backed up without having to go through each folder, etc. individually.)
    The workflow sets up fine, and usually the Find Finder Items step seems to run all the way through. Most of the time it quits unexpectedly partway through the copy step (I have had some folders appear on the desktop, though, seeming to indicate that it's accomplishing something). I reformatted my hard drive a couple months ago, and if I remember right, this same thing has happened both before then and since.
    Does anyone have any tips? I read through some of the other posts in this topic, and it seems that Automator can be kind of perplexing (...and it's entirely possible I'm flubbing up the process somewhere). I've tried looking through the logs that come up when it shuts down, but can't find anything obviously causing the problem.
    I appreciate it. Thanks.
    Powerbook G4 (12")   Mac OS X (10.4.8)  

    Thanks!

  • Problem During reading and write local file

    Hi ,
    I had written a small applet program, it have function �readNwriteFile()� it read/write the local file
    This function works fine when I call it from start () function.
    But whenever I was trying to call this function from java script it gave me this exception.
    �java.security.AccessControlException: access denied (java.io.FilePermission C:\temp_jar\DSC01692.JPG read)�.
    Java script is working fine, I can access any another function from script The problem is some related to access
    I had set the permission in my policy file .this the permission that I had set.
    grant codebase "file:c:\temp_jar"{
    permission java.io.FilePermission "<< ALLFILES >> , "read ,write ,delete ,execute ";
    Java code.
    package com.ravindra;
    import javax.swing.*;
    import java.awt.*;
    import java.io.*;
    import java.util.*;
    public class MialTest extends JApplet{
         public void init() {
         public void start(){
              readNwriteFile(); /// When I call this function from here It is working
         public byte [] readNwriteFile(){
              try {
                   File localfile = null;
                   localfile = new File("C:\\temp_jar\\DSC01692.JPG");
                   FileInputStream fs = new FileInputStream(localfile);
                   ByteArrayOutputStream bs = new ByteArrayOutputStream() ;
                   int actual_data = (int)fs.read();
                   while(actual_data > -1){
                        bs.write(actual_data);
                        actual_data = (int)fs.read();
                   byte [] final_data = bs.toByteArray();
                   File out_file = new File("C:\\temp_jar\\Ravindra_test.JPG");
                   FileOutputStream out_stream = new FileOutputStream(out_file);
                   out_stream.write(final_data);
                   out_stream.flush();
                   fs.close();
                   bs.close();
                   localfile = null;fs = null; bs = null;
                   return final_data;
              } catch (Exception e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
                   return null;
    Java Script Code:

    Hi ,
    I had written a small applet program, it have function �readNwriteFile()� it read/write the local file
    This function works fine when I call it from start () function.
    But whenever I was trying to call this function from java script it gave me this exception.
    �java.security.AccessControlException: access denied (java.io.FilePermission C:\temp_jar\DSC01692.JPG read)�.
    Java script is working fine, I can access any another function from script The problem is some related to access
    I had set the permission in my policy file .this the permission that I had set.
    grant codebase "file:c:\temp_jar"{
    permission java.io.FilePermission "<< ALLFILES >> , "read ,write ,delete ,execute ";
    Java code.
    package com.ravindra;
    import javax.swing.*;
    import java.awt.*;
    import java.io.*;
    import java.util.*;
    public class MialTest extends JApplet{
         public void init() {
         public void start(){
              readNwriteFile(); /// When I call this function from here It is working
         public byte [] readNwriteFile(){
              try {
                   File localfile = null;
                   localfile = new File("C:\\temp_jar\\DSC01692.JPG");
                   FileInputStream fs = new FileInputStream(localfile);
                   ByteArrayOutputStream bs = new ByteArrayOutputStream() ;
                   int actual_data = (int)fs.read();
                   while(actual_data > -1){
                        bs.write(actual_data);
                        actual_data = (int)fs.read();
                   byte [] final_data = bs.toByteArray();
                   File out_file = new File("C:\\temp_jar\\Ravindra_test.JPG");
                   FileOutputStream out_stream = new FileOutputStream(out_file);
                   out_stream.write(final_data);
                   out_stream.flush();
                   fs.close();
                   bs.close();
                   localfile = null;fs = null; bs = null;
                   return final_data;
              } catch (Exception e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
                   return null;
    Java Script Code:

  • Problem using layers from another FLA file

    Hello
    I have an email form in my Flash MX 2004 site here:
    http://stevehigham59.7host.com/myFlash/myFlash.html
    The form, which consists of three layers and some Action
    Script, works fine.
    Then I have a site I am trying to customise, so I have
    recreated the form layer by layer. I do not get any error messages
    from Action Script, but when I try to send myself an email all I
    receive is a message entitled 'undefined'.
    That is, Flash seems to 'see' the PHP script I have -
    otherwise I would not receive any message at all - but it does not
    work as my form does in the link above.
    I thought, maybe, I had recreated the layers wrongly, so I
    did it again, but still no joy.
    What could be the problem?
    Many thanks.
    Steve

    In your "Read From Spreadsheet File", you have your delimiter set to "\s", meaning that the VI expects the delimiter between numbers to be a space.
    Have you actually looked at the formatting of your text file?  Evidently not.  The delimiter in your text file is a tab...not a space. 
    Delete the "\s" input to the VI (a tab delimiter is the default delimiter for "Read From Spreadsheet File") and it'll work fine.  I just did it, and sure enough, it works fine.
    The reason that "Read From Spreadsheet" cannot read your .xls file is because a file created with Excel (that is, an .xls file) is a custom Microsoft format, and not a standard text file.  In order to read an .xls file directly, you'll have to use ActiveX.
    Hope that helps.
    d
    Message Edited by DianeS on 02-14-2010 07:46 PM

Maybe you are looking for