Conversion txt file to tamil language

hi this is aravind
i am finding difficult in conerting the txt file to get converted into locale language (tamil) i did it using the streams but i am geting the output only "?" symbol even though i have entered the unicode i am unable to get the output
plzzzzzzzzzzzzzzzzzzzzzzzzzzzzz help me out it is very urgent

Unicode is used to specify the codes used to represent characters in strings irrespective of locale.
The conversion of strings to bytes, and from bytes to strings is through an encoding.
You are possibly either:
1. Not specifying the encoding, in which case an incorrect default is being used.
2. Specifying an incorrect encoding
3. Are doing all the encoding and decoding correctly, but have a different problem, such as using a font that does not have the tamil unicode range.
My guess would be 1. as most examples use the simpler conversion routines which do not include specifying the encoding.
An example charsetName to use for encoding and decoding is "UTF-8"
So if you have code like this:
BufferedReader in = new BufferedReader(new InputStreamReader(yourFilesInputStream));You should probably be changing it to be something similar to this:
BufferedReader in = new BufferedReader(new InputStreamReader(yourFilesInputStream, "UTF-8"));

Similar Messages

  • .csv file Vs .txt file Content conversion sender file channel

    Hi Experts,
                     I have a file with filename say input.csv.I want to do content conversion for these .CSV file.Is it same like we have to do for .txt file say input.txt.
    when i open my .csv file in notepad, i get multiple rows with each field separated by ';'.what are the content conversion parameters we have to define for .csv file and can we mention input.csv as the file name as a source file name.
    Thanks
    Deepak

    Hi,
    Use the following parameters for Sender file channel in case of reading .csv file
    Recordset Structure.fieldSeparator -
    Recordset Structure.endSeparator -
    'nl'
    Recordset Structure.fieldNames -
    provide field names separated with ,
    Regards
    Seshagiri

  • Accessing txt file in executable vi

    Hi,
    I have built a user interface for a project im working on. The data entered by the user on the interface is saved in a text file upon closing of the program. This is currently working fine but when I create an executable of my code, data is not written to the txt file upon closing. Is there some special way to build these types of VIs,
    The code for writing to the file is in a sub VI and i use the "Write to spreadsheet file" function, i pass in the reference of "C:\Documents and Settings\asha264\Desktop\Single Line\Single Line (9.0)\Data.txt".
    Thanking You,
    Adnan Sharief
    Solved!
    Go to Solution.

    Make sure that your means for signalling the other vi's to exit doesn't have an inadvertent race condition. Remember that LabVIEW is data flow language, that to make sure that certain events occur in a certain order that there is a signal dependecy to force the order of execution. I got bit by that recently when we used a functional global to signal all of the various programmatic loops in the various vi's when it was time to shut down. There was at least one place where, under certain conditions, the loop stop terminal was getting the signal before the "stuff" in the loop had executed. Putting an error in/out on the FG, then puting it in the error line after the functions (actually file writing) guaranteed that the file writes would occur before the "exit" condition was evaluated.
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • How to load a txt file into a table

    Hi,
    I have a txt file
    3 sample records:
    25     fff     fff     2012-03-08 13:42:31.0     2012-03-15 14:58:31.0
    26     ooo     ooo     null     null
    27     ooo     ooo     2012-03-22 10:39:49.0     null
    I have problems with the nulls:
    my ctl is like that:
    load data
    append
    into table table_name
    fields terminated by '\t'
    OPTIONALLY ENCLOSED BY '"' AND '"'
    trailing nullcols
    ( ID CHAR(4000),
    LITERAL CHAR(4000),
    DESCRIPTION_WEB CHAR(4000),
    FECHAALTA TIMESTAMP "YYYY-MM-DD HH24:MI:SS.FF1",
    FECHAMODIFICACION TIMESTAMP "YYYY-MM-DD HH24:MI:SS.FF1"
    I get the following error because of the null:
    Record 2: Rejected - Error on table MKT_WEB, column FECHAALTA.
    ORA-26041: DATETIME/INTERVAL datatype conversion error
    The table in the database:
    ID     NUMBER(10,0)
    LITERAL     VARCHAR2(40 CHAR)
    DESCRIPTION     VARCHAR2(255 CHAR)
    FECHAALTA     TIMESTAMP(0)
    FECHAMODIFICACION     TIMESTAMP(0)
    How can I say to the CTL about the nulls?
    Thanks in advance

    Try external table

  • How to read and write a string into a txt.file

    Hi, I am now using BEA Workshop for Weblogic Platform version10. I am using J2EE is my programming language. The problem I encounter is as the above title; how to read and write a string into a txt.file with a specific root directory? Do you have any sample codes to reference?
    I hope someone can answer my question as soon as possible
    Thank you very much.

    Accessing the file system directly from a web app is a bad idea for several reasons. See http://weblogs.java.net/blog/simongbrown/archive/2003/10/file_access_in.html for a great discussion of the topic.
    On Weblogic there seems to be two ways to access files. First, use a File T3 connector from the console. Second, use java.net.URL with the file: protocol. The T3File object has been deprecated and suggests:
    Deprecated in WebLogic Server 6.1. Use java.net.URL.openConnection() instead.
    Edited by: m0smith on Mar 12, 2008 5:18 PM

  • Error when Importing a txt file in FDM 11.1.2

    Hi,
    I'm getting the following error when I try to import a txt file in FDM. I want to load it in HFM
    Error: An error occurred importing the file.
    Detail: Data access error
    ** Begin FDM Runtime Error Log Entry [2010-10-18 13:07:03] **
    ERROR:
    Code............................................. -2147217900
    Description...................................... Data access error.
    Procedure........................................ clsImpProcessMgr.fLoadAndProcessFile
    Component........................................ upsWObjectsDM
    Version.......................................... 1112
    Thread........................................... 10836
    IDENTIFICATION:
    User............................................. admin
    Computer Name.................................... M0A1187649-2009
    App Name......................................... FDM_ONT
    Client App....................................... WebClient
    CONNECTION:
    Provider......................................... ORAOLEDB.ORACLE
    Data Server......................................
    Database Name.................................... orcl
    Trusted Connect.................................. False
    Connect Status.. Connection Open
    GLOBALS:
    Location......................................... OG
    Location ID...................................... 749
    Location Seg..................................... 3
    Category......................................... ACTUAL
    Category ID...................................... 13
    Period........................................... Mar - 2011
    Period ID........................................ 3/31/2011
    POV Local........................................ False
    Language......................................... 1033
    User Level....................................... 1
    All Partitions................................... True
    Is Auditor....................................... False

    To provide some clarity here, this resolved the issue for use also. The good news is that it should be relatively easy for anyone with FDM Workbench access to resolve this given the following information from the FDM DBA guide (http://docs.oracle.com/cd/E17236_01/epm.1112/fdm_dba.pdf):
    To modify the Oracle Work TablespaceName and Oracle Work Table Index
    TableSpaceName configuration settings:
    1 Launch Workbench, and log on to the FDM application.
    2 Select Tools > Configuration Settings.
    3 Select Options > Oracle Work TableSpaceName.
    4 In Name, enter the name of the tablespace, and click Save.
    5 Select Options > Oracle Work Table Index TableSpaceName.
    6 In Name, enter the name you entered in step 4, and click Save.
    7 Select Options > Oracle Work Table Bitmap Index Switch, and set the value to Off for Oracle 10g and Oracle 11g.
    8 Click Save.
    9 Click Close.
    Step 7 specifically resolves this issue.

  • How to read Chinese word from a TXT file

    File.OpenText() read a TXT File with  Chinese word in   ;but it not show right.
    exam:The TXT File include :中国
     this.Txt1.Text=ofd.File.OpenText().ReadToEnd();
    but it show :��ʹ�ݼƻ��
    How to solve it

    What encoding does the text file use?  Unlike .NET, Silverlight only supports UTF-8 and UTF-16.  File.OpenText() uses UTF-8 by default.
    If the text file is in some other encoding, you can create your own encoding class (that derives from System.Text.Encoding) that can be used to read the text file.
    class MyEncoding : System.Text.Encoding {
    this.Txt1.Text = (new StreamReader(ofd.File.OpenRead(), new MyEncoding())).ReadToEnd();
    Regards,
    Justin Van Patten
    Program Manager
    Common Language Runtime

  • Only writing Integer pixel array to a .txt file,or showing in Frame

    Sir,
    I want to write integer values (range:0 to 255) to a .txt file .Actually after manipulating a .jpeg/.gif image I have gotten a 2D pixel array and a 1D pixel array that can be easily shown in console but I want to write this pixel array into a .txt file. Using of writeInt() is not working. Actually after using this faction the created file contain information which is non-alphanumeric /alphanumeric characters......
    following is error free the code: Plz. See only and only into the �class TestImage�and plz look after line marked by //�my_problem_to_be_resolved.�It is just few lines of code .I promise you will not be bothered.Plz��..
    import java.awt.*;
    import java.io.File;
    import java.io.FileWriter;
    import java.awt.image.*;
    import java.io.*;
    import java.util.*;
    import javax.imageio.*;
    import javax.imageio.stream.*;
    import java.awt.image.Raster;
    import java.awt.image.WritableRaster;
    class Image {
    protected int width,height;
    // 'samples' stores the image pixel values.
    protected int[][] samples;
    // Constructor: Reads the image from the
    // specified file name.
    public Image(String filename)
    throws Exception { read(filename); }
    // Returns the pixel width of the image.
    public int getWidth() { return width; }
    // Returns the pixel height of the image.
    public int getHeight() { return height; }
    // Reads the image from the specified file
    // name into the 'samples' array. Throws an
    // exception if the image is stored in an
    // unsupported file format (currently only
    // .GIF, .JPG, and .PNG are supported by Sun).
    public void read(String filename)
    throws Exception {
    // Extract the file name suffix.
    String ext = filename.substring
    (filename.indexOf('.')+1);
    // Create a file object for the file name.
    File fileImage = new File(filename);
    // Get a list of ImageReaders that claim
    // to be able to decode this image file
    // based on the file name suffix.
    Iterator imageReaders = ImageIO.
    getImageReadersBySuffix(ext);
    ImageReader imageReader;
    // Grab the first ImageReader in the list.
    if (imageReaders.hasNext())
    imageReader = (ImageReader)
    imageReaders.next();
    // If we get here we cannot decode the image.
    else throw new IIOException
    ("Unsupported image format");
    // Create a file input stream object to
    // read the image date.
    FileImageInputStream imageInputStream =
    new FileImageInputStream(fileImage);
    // Tell the ImageReader object to read data
    // from our file input stream object.
    imageReader.setInput(imageInputStream);
    // Get the width and height of the image.
    width = imageReader.getWidth(0);
    height = imageReader.getHeight(0);
    // Read the image from the file input stream,
    // and close the input stream when done.
    BufferedImage bufImage =
    imageReader.read(0);
    imageInputStream.close();
    // Get a raster object so we can extract the
    // pixel data from the BufferedImage.
    WritableRaster wRaster =
    bufImage.getRaster();
    // Create our 'samples' 2d-array.
    samples = new int[height][width];
    // Extract the image data into our 'samples'
    // array.
    for (int row = 0; row < height; row++)
    for (int col = 0; col < width; col++)
    samples[row][col] =
    wRaster.getSample(col,row,0);
    // Write the image stored in the 'samples'
    // array to the specified file. The file name
    // suffix should be a supported image file
    // format (currently either .JPG or .PNG).
    public void write(String filename)
    throws Exception {
    // Extract the file name suffix.
    String ext = filename.substring
    (filename.indexOf('.')+1);
    // Create a file object for the file name.
    File fileImage = new File(filename);
    // Get a list of ImageWriters that claim to
    // be able to encode images in the specified
    // image file format based on the file name
    // suffix.
    Iterator imageWriters = ImageIO.
    getImageWritersBySuffix(ext);
    ImageWriter imageWriter;
    // Grab the first ImageWriter in the list.
    if (imageWriters.hasNext())
    imageWriter = (ImageWriter)
    imageWriters.next();
    // If we get here we cannot encode the image.
    else throw new IIOException
    ("Unsupported image format");
    // Create a file output stream object to
    // write the image data.
    FileImageOutputStream imageOutputStream
    = new FileImageOutputStream
    (fileImage);
    // Tell the ImageWriter to use our file
    // output stream object.
    imageWriter.setOutput
    (imageOutputStream);
    // The ImageWriter.write() method expects a
    // BufferedImage. Convert our 'samples' array
    // into a BufferedImage.
    BufferedImage bufImage =
    createBufferedImage();
    // Encode the image to the output file.
    imageWriter.write(bufImage);
    imageOutputStream.close();
    // Draws the image stored in the 'samples'
    // array on the specified graphics context.
    public void draw(Graphics gc,int x,int y){
    BufferedImage bufImage =
    createBufferedImage();
    gc.drawImage(bufImage,x,y,null);
    // Converts the 'samples' array into a
    // BufferedImage object. Students do not have
    // to understand how this works.
    private BufferedImage
    createBufferedImage() {
    // Create a monochrome BufferedImage object.
    BufferedImage bufImage = new
    BufferedImage(width,height,
    BufferedImage.TYPE_BYTE_GRAY);
    // Create a WriteableRaster object so we can
    // put sample data into the BufferedImage
    // object's raster.
    WritableRaster wRaster =
    bufImage.getRaster();
    // Copy the 'samples' data into the
    // BufferedImage object's raster.
    for (int row = 0; row < height; row++)
    for (int col = 0; col < width; col++)
    wRaster.setSample
    (col,row,0,samples[row][col]);
    // Return the newly created BufferedImage.
    return bufImage;
    } // End of Class Image
    class TestImage {
    public static void main(String args[])
    throws Exception {
    // Create a frame to display the image.
    Frame frame = new Frame("Test Image");
    frame.setSize(1024,768);
    frame.setVisible(true);
    Graphics gc = frame.getGraphics();
    try {
    // Read the image from the file.
    Image img = new Image("C:/lilies.jpg");
    int height=img.getHeight();
    int width =img.getWidth();
    //�my_problem_to_be_resolved.�
         File image_object_arry=new File("C:/Image_array.txt");
         FileOutputStream image_object_arry_stream= new FileOutputStream(image_object_arry);
         DataOutputStream int_image_object_arry_stream=new DataOutputStream(image_object_arry_stream);
    //Conversion of two dimensional pixel arrry into one dimensional array
    int intPixels1[] = new int [height * width];
    int k = 0;
    for(int i = 0; i <= width; i++) {
    for(int j = 0; j <= height; j++) {
    intPixels1[k] = img.samples[i][j];
    int_image_object_arry_stream.writeInt((int) intPixels1[k]);
    // System.out.println(intPixels1[k]);
    k = k+1;
    import java.awt.*;
    import java.io.File;
    import java.io.FileWriter;
    import java.awt.image.*;
    import java.io.*;
    import java.util.*;
    import javax.imageio.*;
    import javax.imageio.stream.*;
    import java.awt.image.Raster;
    import java.awt.image.WritableRaster;
    class Image {
    protected int width,height;
    // 'samples' stores the image pixel values.
    protected int[][] samples;
    // Constructor: Reads the image from the
    // specified file name.
    public Image(String filename)
    throws Exception { read(filename); }
    // Returns the pixel width of the image.
    public int getWidth() { return width; }
    // Returns the pixel height of the image.
    public int getHeight() { return height; }
    // Reads the image from the specified file
    // name into the 'samples' array. Throws an
    // exception if the image is stored in an
    // unsupported file format (currently only
    // .GIF, .JPG, and .PNG are supported by Sun).
    public void read(String filename)
    throws Exception {
    // Extract the file name suffix.
    String ext = filename.substring
    (filename.indexOf('.')+1);
    // Create a file object for the file name.
    File fileImage = new File(filename);
    // Get a list of ImageReaders that claim
    // to be able to decode this image file
    // based on the file name suffix.
    Iterator imageReaders = ImageIO.
    getImageReadersBySuffix(ext);
    ImageReader imageReader;
    // Grab the first ImageReader in the list.
    if (imageReaders.hasNext())
    imageReader = (ImageReader)
    imageReaders.next();
    // If we get here we cannot decode the image.
    else throw new IIOException
    ("Unsupported image format");
    // Create a file input stream object to
    // read the image date.
    FileImageInputStream imageInputStream =
    new FileImageInputStream(fileImage);
    // Tell the ImageReader object to read data
    // from our file input stream object.
    imageReader.setInput(imageInputStream);
    // Get the width and height of the image.
    width = imageReader.getWidth(0);
    height = imageReader.getHeight(0);
    // Read the image from the file input stream,
    // and close the input stream when done.
    BufferedImage bufImage =
    imageReader.read(0);
    imageInputStream.close();
    // Get a raster object so we can extract the
    // pixel data from the BufferedImage.
    WritableRaster wRaster =
    bufImage.getRaster();
    // Create our 'samples' 2d-array.
    samples = new int[height][width];
    // Extract the image data into our 'samples'
    // array.
    for (int row = 0; row < height; row++)
    for (int col = 0; col < width; col++)
    samples[row][col] =
    wRaster.getSample(col,row,0);
    // Write the image stored in the 'samples'
    // array to the specified file. The file name
    // suffix should be a supported image file
    // format (currently either .JPG or .PNG).
    public void write(String filename)
    throws Exception {
    // Extract the file name suffix.
    String ext = filename.substring
    (filename.indexOf('.')+1);
    // Create a file object for the file name.
    File fileImage = new File(filename);
    // Get a list of ImageWriters that claim to
    // be able to encode images in the specified
    // image file format based on the file name
    // suffix.
    Iterator imageWriters = ImageIO.
    getImageWritersBySuffix(ext);
    ImageWriter imageWriter;
    // Grab the first ImageWriter in the list.
    if (imageWriters.hasNext())
    imageWriter = (ImageWriter)
    imageWriters.next();
    // If we get here we cannot encode the image.
    else throw new IIOException
    ("Unsupported image format");
    // Create a file output stream object to
    // write the image data.
    FileImageOutputStream imageOutputStream
    = new FileImageOutputStream
    (fileImage);
    // Tell the ImageWriter to use our file
    // output stream object.
    imageWriter.setOutput
    (imageOutputStream);
    // The ImageWriter.write() method expects a
    // BufferedImage. Convert our 'samples' array
    // into a BufferedImage.
    BufferedImage bufImage =
    createBufferedImage();
    // Encode the image to the output file.
    imageWriter.write(bufImage);
    imageOutputStream.close();
    // Draws the image stored in the 'samples'
    // array on the specified graphics context.
    public void draw(Graphics gc,int x,int y){
    BufferedImage bufImage =
    createBufferedImage();
    gc.drawImage(bufImage,x,y,null);
    // Converts the 'samples' array into a
    // BufferedImage object. Students do not have
    // to understand how this works.
    private BufferedImage
    createBufferedImage() {
    // Create a monochrome BufferedImage object.
    BufferedImage bufImage = new
    BufferedImage(width,height,
    BufferedImage.TYPE_BYTE_GRAY);
    // Create a WriteableRaster object so we can
    // put sample data into the BufferedImage
    // object's raster.
    WritableRaster wRaster =
    bufImage.getRaster();
    // Copy the 'samples' data into the
    // BufferedImage object's raster.
    for (int row = 0; row < height; row++)
    for (int col = 0; col < width; col++)
    wRaster.setSample
    (col,row,0,samples[row][col]);
    // Return the newly created BufferedImage.
    return bufImage;
    } // End of Class Image
    /*class TestImage {
    public static void main(String args[])
    throws Exception {
    // Create a frame to display the image.
    Frame frame = new Frame("Test Image");
    frame.setSize(1024,768);
    frame.setVisible(true);
    Graphics gc = frame.getGraphics();
    try {
    // Read the image from the file.
    Image img = new Image("C:/srk.jpg");
    // Display the image.
    img.draw(gc,10,40);
    // Flip the image upside down
    //img.flipX();
    // Display the flipped image.
    img.draw(gc,20+img.getWidth(),40);
    // Write the new image to a file
    img.write("HorseNew.jpg");
    } catch (Exception e) {
    System.out.println
    ("Exception in main() "+e.toString());
    class TestImage {
    public static void main(String args[])
    throws Exception {
    // Create a frame to display the image.
    Frame frame = new Frame("Test Image");
    frame.setSize(1024,768);
    frame.setVisible(true);
    Graphics gc = frame.getGraphics();
    try {
    // Read the image from the file.
    Image img = new Image("C:/lilies.jpg");
    int height=img.getHeight();
    int width =img.getWidth();
    File image_object_arry=new File("C:/Image_array.txt");
    FileOutputStream image_object_arry_stream=new FileOutputStream(image_object_arry);
         DataOutputStream int_image_object_arry_stream=new DataOutputStream(image_object_arry_stream);
    //Conversion of two dimensional pixel arrry into one dimensional array
    int intPixels1[] = new int [height * width];
    int k = 0;
    for(int i = 0; i <= width; i++) {
    for(int j = 0; j <= height; j++) {
    intPixels1[k] = img.samples[i][j];
    int_image_object_arry_stream.writeInt((int) intPixels1[k]);
    // System.out.println(intPixels1[k]);
    k = k+1;
    catch (Exception e) {
    System.out.println("Exception in main() "+e.toString());
    catch (Exception e) {
    System.out.println("Exception in main() "+e.toString());
    }

    My Friend, you need to put your code within CODE tags
    And I suspect if anyone would go through your code this way.
    Assuming your problem is to write pixel values to a file you may use this,
          try{
            // Create file
            FileWriter fstream = new FileWriter("out.txt");
            BufferedWriter out = new BufferedWriter(fstream);
            for(int i =0; pixels.length() ; i++)
              out.write(pixels[i]+"\t");
           //Close the output stream
           out.close();
           }catch (Exception e){//Catch exception if any
          System.err.println("Error: " + e.getMessage());
        }

  • How to skip first TWO Lines of   .txt  file    using XSLT Mapping

    Hi Friends  ,
                              I have an .txt file in has the format as
                               <TEST>
                                4564564545
                                56456444566
                                56465
                                    How can i skip the first two Lines when i am writing the XSLT Mapping ?
                              That <TEST> and empty line shouldn't go the rfc  .
                             How can i skip and sent to rfc  using XSLT Mapping ?
    Best Regards .,
    V.Rangarajan

    you can avoid the empty lines in your File Content Conversion by defining offset.
    <i>Under Document Offset, specify the number of lines that are to be ignored at the beginning of the document.
    This enables you to skip comment lines or column names during processing. If you do not make an entry, the default value is zero lines.</i>
    ref: http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm
    then the generated XML after FCC will not have the empty lines.

  • Process txt files in zip file

    Hello everybody,
    I have a scenario where PI needs to obtain a zip file via FTP using the File adapter, this zip file contains a number of txt files that I need to process, and the content of one of them send it to an ECC, now I'm using the PayloadZipBean Module in the Sender FIle Adapter, and I have two things if I use the Message Protocol as File, I get a Payload for each txt file in the zip file, but this payload has no structure, and if I use the File Content Conversion I get an XML strcuture with only one field and a strange string in it, and somewhere in this string the names of the files I assume all the content of the zip file, can anyone help on how could I achieve what I need that is to pull the zip file via SAP PI, then unzip it, and with the content of one of the txt files send it to an ECC via ABAP Proxy, thanks in advance for your answers.
    Regards,
    Julio Cesar

    Hi,
    you can do it in futher way ...
    pickup zip file and simply extract and dump it in another temp folder (can use scripts on OS level).
    @ then Use another sender communication channel to pickup all these text file .
    for further clarification you can use these links also. -
    Re: PI needs to obtain a zip file via FTP using the File adapter
    Accessing File using FTP from Java Mapping
    File Sender Adapter with FTP protocol
    BR
    Raj

  • Reading .txt file and non-english chars

    i added .txt files to my app for translations of text messages
    the problem is when i read the translations, non-english characters are read wrong on my Nokia. In Sun Wireless Toolkit it works.
    See the trouble is because I don't even know what is expected by phone...
    UTF-8, ISO Latin 2 or Windows CP1250?
    im using CLDC1.0 and MIDP1.0
    What's the rigth way to do it?
    here's what i have...
    String locale =System.getProperty("microedition.locale");
    String language = locale.substring(0,2);
    String localefile="lang/"+language+".txt";
    InputStream r= getClass().getResourceAsStream("/lang/"+language+".txt");
    byte[] filetext=new byte[2000];
    int len = 0;
    try {
    len=r.read(filetext);
    then i get translation by
    value = new String(filetext,start, i-start).trim();

    Not sure what the issue is with the runtime. How are you outputing the file and accessing the lists? Here is a more complete sample:
    public class Foo {
         final private List colons = new ArrayList();
         final private List nonColons = new ArrayList();
         static final public void main(final String[] args)
              throws Throwable {
              Foo foo = new Foo();
              foo.input();
              foo.output();
         private void input()
              throws IOException {
             BufferedReader reader = new BufferedReader(new FileReader("/temp/foo.txt"));
             String line = reader.readLine();
             while (line != null) {
                 List target = line.indexOf(":") >= 0 ? colons : nonColons;
                 target.add(line);
                 line = reader.readLine();
             reader.close();
         private void output() {
              System.out.println("Colons:");
              Iterator itorColons = colons.iterator();
              while (itorColons.hasNext()) {
                   String current = (String) itorColons.next();
                   System.out.println(current);
              System.out.println("Non-Colons");
              Iterator itorNonColons = nonColons.iterator();
              while (itorNonColons.hasNext()) {
                   String current = (String) itorNonColons.next();
                   System.out.println(current);
    }The output generated is:
    Colons:
    a:b
    b:c
    Non-Colons
    a
    b
    c
    My guess is that you are iterating through your lists incorrectly. But glad I could help.
    - Saish

  • Text layers from .txt file for buisness cards

    I have a template for a business card that I created for a company. So  imagine I have a background layer which is the card itself, and above  that a layer for each string of text on the card (name, title, phone,  email). Up until now, I would manually enter all the information using  the Type tool to edit each text layer. However, it has become very  tedious and I know there has to be a much easier way to do this. I'm  looking for a way to automate this process.  So far I have created an Excel database of all the  employees, and I export each employees information to a .txt file that  looks like this:
    John Doe
    Job Title
    123-456-7890
    123-456-7890
    [email protected]
    Each line in the .txt file corresponds to a text layer on the .psd. I've  tried following a tutorial from the web (kirupa.com - Photoshop Scripting) but he is creating  them in batches which is not what I need to do. And quite frankly, it's  a bit over my head. I know scripting must be the way, but unfortunately  I don't know much about JaveScript or any  other language for that matter.
    I know it's a lot to ask for, but if anyone could show me how to write a  simple script for this or point me in the right direction, it would be  much appreciated. And I mean MUCH!

    Hey man, that was spot on! This does exactly what I was looking for, now scripting required. Thanks for the help, I really appreciate it.

  • [CS3 JS]  Reading TXT file content into String

    Hello,
    I'm currently wanting to display a dialog box that has a dropdown menu containing all countries of the world.
    I have an external txt file that contains a list of all countries.
    I thought I would simply read-in the contents of the 'txt' file into a string and use it for displaying the list.
    For example
    i Instead of the usual:
    > var myLandMenu = dropdowns.add({stringList:["A", "B"...], selectedIndex:0});
    i I thought of doing something like:
    > var myLandList = ....? HELP ?....
    > var myLandMenu = dropdowns.add({stringList:myLandList, selectedIndex:0});
    Is this the way to do it?
    What would be the way to read in the text file content as a string?
    Thanks in advance,
    Lee

    > var myLandList = ....? HELP ?....
    > var myLandMenu = dropdowns.add({stringList:myLandList, selectedIndex:0});
    It's hard to tell from context, but myLandList needs to be an array of strings.
    If the file has one element per line, this would be one way of handling the
    conversion:
    var file = File("~/countries.txt");
    file.open("r");
    var str = file.read();
    file.close();
    var myLandList = str.split(/[\r\n]+/);
    And assuming that this is ScriptUI and not the older ID UI, the menu creation
    would look more like:
    var myLandMenu = dropdowns.add(bounds, myLandList);
    myLandMenu.items[0].selected = true;
    -X
    for photoshop scripting solutions of all sorts
    contact: [email protected]

  • Txt file to XML using File Adapter

    Dear  ALL,
    I am doing file to file scenario, where i have to convert txt file from sender to xml as receiver .
    I have done with all the conversion content parameters at the sender file adapter as below:
    DocumentName:
    DocumentNamespace:
    RecordsetName:
    RecordsetStructure:
    Row.fieldNames :
    Row.fieldSeparator:
    Row.endSeperator:
    Row.fromConfiguration;
    Row.fieldFixedLengths:
    Am i missing anything
    still i am getting error as .
    Conversion initialization failed: java.lang.Exception: java.lang.Exception: java.lang.Exception: Error(s) in XML conversion parameters found: Parameter 'Row.fieldFixedLengths' or 'Row.fieldSeparator' is missing Consistency check: no. of arguments in 'Row.fieldFixedLength' does not match 'Row.fieldNames' (0 <> 6)
    Could anyone let me know where i am wrong in config.
    Kind Regards,
    Vijay

    Raj,
    Please find the details
    DocumentName:            sto_dc.txt
    DocumentNamespace:    http://........
    RecordsetName:             MT_STO_FILEOUT
    RecordsetStructure:        Row,*
    Row.fieldNames :   Document_number,Site,Date,Item_number,
                                        Article_number,Quantity
    Row.fieldSeparator:         ,
    Row.endSeperator:        'nl'
    Row.fromConfiguration;   fromConfiguration
    Row.fieldFixedLengths:  8,4,8,2,6,2
    Regards,
    Vijay

  • Writing the ASCII value of a character found in a .txt file

    I have a program that reads in a file and outputs certain characters to a new smaller file. The program works fine (thanks to some forum help) but I now need to print the ASCII value of the characters that are written to the file.
    The problem I'm having (besides writing the ascii value of the char) is that the Unix .txt file has some weird properties. When I run the program on a .txt test file that I created with spaces in it, the program ignores the space characters.
    Yet, when I run the program on the Unix file it wites the 'spaces' to the output file. That is why I want to write/print the ASCII value of the "blank "character in the Unix .txt file.
    I already serached the forum and did a Google search for Char to ASCII conversion but I didn't find anything.
    Thanks,
    LS6v
    Here's the code and the clips of the ouput files:
    package source;
    import javax.swing.*;
    import java.io.*;
    public class Scanner4
         public static void main(String[] args)
              getContents();
              System.exit(0);
         public static void getContents()
              char charArray[] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
                                         'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
                                           '0','1','2','3','4','5','6','7','8','9','$','.', '#', '-', '/', '*', '&', '(', ')',' '};
              String Chars = null;
              String lineSep = System.getProperty("line.separator");
              int iterator = 0;
              int i = 0;
              int charNum = 1;
              int lineCount = 1;          
             // StringBuffer contents = new StringBuffer();
             //declared here only to make visible to finally clause
             BufferedReader input = null;
             BufferedWriter out = null;
             try {
                         //use buffering
                         //this implementation reads one line at a time
                         input = new BufferedReader( new FileReader( "C:\\testFile\\test1.txt" ));
                         out = new BufferedWriter( new FileWriter( "C:\\Scan file test\\Write\\test.txt" ));
                         String line = null;
                    out.write( "Character\tLine Number\tCharacter Number" + lineSep ); 
                              while (( line = input.readLine()) != null)
                               //contents.append(System.getProperty("line.separator"));
                               i = 0;
                               charNum = 1;
                               iterator = 0;
                              while( i < line.length() )
                                             for( int count = 0; count < charArray.length; count++)
                                                  if( (charArray[count] != line.charAt(iterator)) && (count+1 == charArray.length) )
                                                       out.write( "[" + line.charAt(iterator) + "]\t\t" + "[" + lineCount + "]\t\t" + "[" + charNum + "]" + lineSep);
                                                  if( charArray[count] == line.charAt(iterator) )
                                                       break;
                                        charNum +=1;
                                        iterator +=1;
                                        i++;                               
                                 lineCount +=1;
             catch (FileNotFoundException ex) {ex.printStackTrace();     System.out.println("File not found.");}          
                 catch (IOException ex){ex.printStackTrace();               System.out.println("IO Error.");}
             finally
                           try{
                                 if (input!= null){
                               //flush and close both "input" and its underlying FileReader
                                 input.close();
                                 out.close();
               catch (IOException ex){ex.printStackTrace();  System.out.println("IO Error #2.");}
    My created .txt file:
    1. a!asdsad
    2. @
    3. #
    4. $
    5. %sdfsdf
    6. ^
    7. &
    8. *
    9. (
    10. )
    11. _
    12. +sdfsdfsdf
    13. -
    14. =
    15. ~
    16. `
    17. dfgdfg;
    18. :
    19. '
    20. "fghfghf
    21. ,
    22. dfgdfg<
    23. .
    24. >fghfghfg
    25. /
    26. gggggggggggggggggggggggg?
    27. a
    Output for my .txt file:
    Character     Line Number     Character Number
    [!]          [1]          [5]
    [@]          [2]          [4]
    [%]          [5]          [4]
    [^]          [6]          [4]
    [_]          [11]          [5]
    [+]          [12]          [5]
    [=]          [14]          [5]
    [~]          [15]          [5]
    [`]          [16]          [5]
    [;]          [17]          [11]
    [:]          [18]          [5]
    [']          [19]          [5]
    ["]          [20]          [5]
    [,]          [21]          [5]
    [<]          [22]          [11]
    [>]          [24]          [5]
    [?]          [26]          [29]************************************************************************
    Output generated after reading the .txt file from the unix box:
    Character     Line Number     Character Number
    [ ]          [1]          [17]
    [ ]          [1]          [18]
    [ ]          [1]          [19]
    [ ]          [1]          [6530]
    [ ]          [2]          [2041]
    [']          [29]          [1834]
    [']          [29]          [2023]
    [']          [30]          [1834]
    [']          [30]          [2023]
    [']          [30]          [2066]
    [']          [47]          [2066]
    [']          [67]          [2067]
    [']          [77]          [2066]
    [+]          [80]          [28]

    Thanks I didn't even think to try and cast it to an int...
    The tool I'm using to create my .txt in windows is Notepad.
    I wrote a program to simply copy the original (3GB) Unix file and terminated it early so I could see what was there. What I found was some text and symbols and a lot of space between brief bursts of text. I can't really copy and paste an example because the amount of space is too large, it's basically a 3GB unformatted .txt file...
    Unix file was created on: unknown
    It sounds like the .txt file that I copied from the Unix box was formatted differently. But I thought that the formatting had more to do with end of line issues, not blank space between characters. Because a blank space should be seen by my program and ignored...
    Here's the ASCII value of the "blank" spaces:
    Character     Line Number     Character Number
    [ ]          [1]          [17]     Ascii Value: [0]
    [ ]          [1]          [18]     Ascii Value: [0]
    [']          [868]          [2066]     Ascii Value: [39]
    [,]          [877]          [186]     Ascii Value: [44]
    [,]          [877]          [276]     Ascii Value: [44]
    Also, the Ascii value printed for the blank spaces looks like the number zero here but it looks like it has strange points on the bottom of it in my output file. It looks like the extended ASCII character 234 &#937;

Maybe you are looking for

  • Execute Stored Procedure from C#

    Hi, im new to using stored procedures and i have the following stored procedure... CREATE OR REPLACE PROCEDURE DRL_PROCEDURE2(var_SOURCE_OBJECTID IN varchar2, var_NEW_OBJECTID OUT varchar2) AS BEGIN SELECT MAX(NEW_OBJECTID) INTO var_NEW_OBJECTID FROM

  • Multi Org in Release 12

    As like in 11i, do we need to run multi org in Release 12. If no needed, if it comes with default in release 12, what MO:operating unit will it take.

  • Not allowing conversion

    I paid for a year, but after a couple of months the program is not allowing conversions. What happened?

  • Strange Image when Saving

    Hi. I make my image image1.getGraphics().drawImage(top, 50, 100, null); image1.getGraphics().drawImage(right, 250,100, null); image1.getGraphics().drawImage(front, 50,200,200,200, null); myPannel.setImage(elaboraImmagini()); myPannel.repaint();I see

  • My iPad Mini is not turning on

    Hi I need help! Last night I went to go get my iPad Mini that I have had for a year. It would not turn on and it was on 50 % I pressed the home button and power and it still would not turn on so I plugged it in to charge and nothing happened. The wei