Differentiate ASCII text file from binary

Is there any way to find whether a file is binary ( non-ascii ), other than to check each and every byte ? Does java io package is having any API for this ?

Even by checking each byte, you wouldn't know.
How do you determine whether 56 E3 are two binary
bytes or a UTF-16 char for some foreign language?If you noticed a lot of the lower numbers being used (the control characters, below 32, or is it 27).

Similar Messages

  • How to copy/send text file from FTPS to SAP ECC File Port

    Hi Frdns,
    I am working on one design, actually my requirement as follows
    I am receiving financial information document from Banks, which is in the form of BIA2 message format, it looks like text file. This information needs to be sending to SAP ECC system.
    I identified some approaches to full fill the requirement
    1)Using Conversion agent/or third party tools to convert BIA2 message in to XML, then using PI I will pick up the XML message, convert it in to IDoc.
    2)Without any conversion I will copy the same file (original BIA2 message) in to SAP ECC file port, in this case no conversion required, calling some program I will schedule it.
    I am looking forward t implement the second approach because it saves lot of money to my client.
    Now I am wondering using File adapter can i copy to SAP ECC File Port or I required ABAP proxy?
    What is the best approach to copy the BIA message text file from FTPS to SAP ECC File Port.??
    Regards,
    Raj

    Hi Raja,
    >>Now I am wondering using File adapter can i copy to SAP ECC File Port or I required ABAP proxy?
    Yes you can do this copy, the only restriction that can happen is the file size.. If you are sure that the fiel will be of few MB at the max then you can use the Configuration part alone and copy it to ECC folder. For doing this you need the following:
    1. Sender agreement (mention the sender interface as anything XYZ)
    2. Sender communication channel. Pick the file in binary mode
    3. Receiver determination (keep both the sender and receiver service as same)
    4. Interface Detemiantion (dont specify any mapping and keep the receiver interface name as XYZ)
    5. Create receiver agreement (with same service and interface)
    6. Use file adapter here
    Regards
    Suraj

  • Creating acscii control file from binary control file

    Hi,
    We are in the process of cloning DB on a different server from cold backups taken on source server. The DBA forgot to take the backup of control file by dumping to trace using command
    alter database backup controlfile to trace;
    We have the cold backup files of control files.
    Is there was to create ascii control file from those binary control file?
    I am wondering if we can use any binary file editors like emacs to do this
    Is there any other way to clone it without backup of control file?
    TIA
    andy

    Apart from that I recommend you to have this thread on hand if you get any trouble duplicating the database.
    TIP 04: Duplicating a Database in 10g by Joel Pèrez
    TIP 04: Duplicating a Database in 10g by Joel Pèrez
    Joel Pérez
    http://otn.oracle.com/experts

  • How to upload a text file from a shared folder and provide an o/p

    how to upload a text file from a shared folder and provide an o/p  containing the details in each order in the text file

    Hi,
    Use <b>GUI_UPLOAD</b> to upload a text file from a shared folder.
    Use <b>GUI_DOWNLOAD</b> to download data in a file on the presentation server or use <b>OPEN DATASET, TRANSFER</b> and <b>CLOSE DATASET</b> statements to download data to the application server.
    Now, I hope the code for data fetching, if required, is already present in the report.
    Reward points if the answer is helpful.
    Regards,
    Mukul

  • Sending EMail "Text-File" from Application Server!

    Hi Experts,
    how can I sending a Text-File from Application Server via Email?
    Is there existing a Function Modul?
    With Kind regards
    Ersin
    Moderator message: sending emails = FAQ, please search before posting.
    Edited by: Thomas Zloch on Nov 25, 2010 4:23 PM

    STF (Search the forum)!  This type of question has been asked...and answered....many times.

  • Reading and writing to a text file from an Applet

    I'm a novice java programming with very little formal programming training. I've pieced together enough knowledge to do what I've wanted to do so far...
    However, I've been unable to figure out how to read and write to a text file from an Applet (I can do it from a normal java program just fine). Here is a simple example of what I'd like to do (you can also look at it on my website: www.stat.colostate.edu/~leach/test02/test02.html). I know that there is some problem with permission/security but I'm not smart enough to understand what the error messages are telling or understand the few books I have. If anyone can tell me how to get this applet to work, or direct me to some referrences that would help me out I'd really appreciate it.
    Thanks,
    Andy
    import java.applet.Applet;
    import java.net.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.io.*;
    public class test02 extends Applet {
    public Button B_go;
    public GridBagConstraints c;
    public void init() {
    this.setLayout(new GridBagLayout());
    c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    B_go = new Button("GO");
    c.gridx=1; c.gridy=0; c.gridwidth=1; c.gridheight=1;
    c.weightx = c.weighty = 0.0;
    B_go.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    print_stuff();
    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    this.add(B_go,c);
    public static void print_stuff() {
    try{
    File f = new File("test02.txt");
    PrintWriter out = new PrintWriter(new FileWriter(f));
    out.print("This is test02.txt");
    out.close();
    }catch(IOException e){**/}
    }

    I have almost the exact same problem, and I am in the same situation as you are with respects to the language.
    I am simply trying to create a file and output some garbage to it but my applet always spits back a security violation. I've tried eliminating the restrictions on the applet runner I use but I still get the error.
    My method:
    debug = new Label() ;
    debug.setLocation( 20, 20 ) ;
    debug.setSize( 500, 15 ) ;
    add( debug ) ;
    // output
    try
         OutputStream file = new FileOutputStream( new File( "" + getCodeBase() + "output.txt" ) ) ;
         byte[] buffer = { 1, 2, 3, 4, 5 } ;
         file.write( buffer ) ;
         file.close() ;
    } catch( Exception e )
         debug.setText( e.toString() ) ;
         Can anyone tell why this isnt working?

  • How to download a text file from the server

    hi everyone,
    can anyone tell me how to download and read a text file from the server and saved in into resource folder.
    with regards
    pallavi

    its really easy
    To read from server, use something like:
    HttpConnection connector = null;
    InputStream inp_stream = null;
    OutputStream out_stream = null;
    void CloseConnection()
         if(inp_stream!=null)inp_stream.close();
         inp_stream=null;
         if(out_stream!=null)out_stream.close();
         out_stream=null;
         connector.close();
         connector = null;
    public void getResponse(String URL,String params)
      try
         if(connector==null)connector = (HttpConnection)Connector.open(URL);//URL of your text file / php script
         connector.setRequestMethod(HttpConnection.POST);
         connector.setRequestProperty("User-Agent","Profile/MIDP-2.0 Configuration/CLDC-1.1");
         connector.setRequestProperty("content-type", "application/x-www-form-urlencoded");
         //connector.setRequestProperty("charset","windows-1251");
         //*** If you need to send ("arg1=value&arg2=value") arguments to script use this:
         out_stream = connector.openOutputStream();
         byte postmsg[] = params.getBytes();
         out_stream.write(postmsg);
         int rc = connector.getResponseCode();//in any case here connection will be opened & closed
         if (rc != HttpConnection.HTTP_OK)
              CloseConnection();
              throw new IOException("HTTP response code: " + rc);
         inp_stream = connector.openInputStream();
         int pack_len = inp_stream.available();
         byte answ[]=new byte[pack_len];
         inp_stream.read(answ);
         CloseConnection();
         ProcAnswer(answ);//process received data
      catch(Exception ex)
         System.err.println("ERROR IN getResponse(): "+ex);
    } And you can read from resource file like
    public void loadFile(String filename)
        DataInputStream dis = new DataInputStream(getClass().getResourceAsStream("/"+filename));
        String str="";
        try
             while (true)
                ch = dis.read();//read character
                if(ch=='\r')continue;//if file made in windows
                if(ch=='\n' || ch==-1)//end of line or end of file
                    if(str.length()==0)continue;//if empty line
                    //do some thing with "str"
                    if(ch==-1)break;//it was last line
                    str="";//next line
                    continue;
                 str+=(char)ch;
           dis.close();
       catch (Exception e)
           System.err.println("ERROR in loadFile() " + e);
    }Welcome! =)
    Edited by: MorskoyZmey on Aug 14, 2008 3:40 AM

  • How do I move text files from my desktop to my iPod Touch?

    How do I transfer (export) text files from my Mac (word processor files) to the Notes app on my iPod?

    WesternGuy wrote:
    I am going to assume that I can move individual profiles, or even delete profiles that I no longer need.
    Just be aware that if you delete or don't move profiles that are currently assigned to images LR will (without warning) reassign those images with the Adobe Standard profile.
    You can use AnyFilter, Data Explorer, or DevMeta plugins to determine if any images are assigned to a profile you want to delete. You can then reassign the profile of your choice. Once that's completed you can safely delete the camera profile.

  • Producing text file from PL/SQL procedure (UTL_FILE)?

    Hi,
    I need to produce a text file from a PL/SQL procedure. My output should be a little over 38K records and my query has 70 fields. I'd like to separate the fields by pipe delimiters in the text file. I can either concatenate all 70 fields into one variable for each record or send all 70 fields over with a pipe, whichever is easier. It looks like I can't spool within PL/SQL but UTL_FILE might be an option from what I'm reading. Does anyone have any good, simple example(s) to produce a text file using this package in calling multiple fields from a LOOP? Our os is UNIX and db is Oracle 9i.
    Also, I've read that UTL_FILE has a record output of 1,023 bytes. Is this for each record line or the whole file size? I belive the max # of characters for each line wouldn't exceed 500 characters. The 38K rows I have for the data set would be well over 1MB. If this is the case, is there a work around to produce a larger text file?
    Any suggestions and/or examples would be greatly appreciated.
    Thanks,
    Eric

    Assuming the goal is to create a text file on the database server, you can use UTL_FILE here. Each line can be 1023 characters, but you can have as many lines as you'd like.
    Tom Kyte has an example here
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:235814350980
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • 'No Upload Authorization' While Uploading a Text File from Multiple Select

    Hi all,
       The User is trying to upload a text file from Multiple Selection screen of a Query in BEx and it gives the error message of 'No Upload Authorization' (Error DB886).
       In 'Logon data' tab of Tcode SU01, it has 'User' for 'User Group for Authorization check' for this User.
       I could upload a text file from Multiple Selection screen with my User Id.
       An idea about this error, PLEASE ?
    Thanks,
    Venkat.

    Hi Ron,
       This User does not have the access to Tcode ST01.
       The user executed Tcode SU53 immediately following the authorization failure to see the authorization objects. The 'Authorization obj' is blank and under the Description it has 'The last Authorization check was successful' with green tick mark.
      Any further suggestions, PLEASE.
    Thanks.

  • Loading a text file from a relative location in shockwave

    Hi all
    I'm REALLY sorry I have to post about such an inane problem.
    I've googled this and looked in forums and found several
    suggestions but none of them are working for me. I want to load a
    text file from the same directory as my movie. I can get this
    working in authoring mode, in a projector, and in a shockwave movie
    on the local machine (using getNetText("/text.txt")).
    But when i put the shockwave movie on a server, it does NOT
    work. The macromedia documentation says that getNetText works with
    relative URLs. But when I put in the full URL, it does work, so
    obviously the shockwave movie is having a problem finding the text
    file which IS in the same directory as it.
    Any suggestions / ideas? All i want to do is access a text
    file :)
    Sorry again for such a lame problem
    Mike

    thanks - this worked. I also had to not use a repeat loop to
    wait for netDone() to return true.
    Thanks again
    MIke

  • What are some of the best iOS apps can remotely played videos, audios, photos and text files from a NAS hdd connected to Airport Extreme USB port? And how to configure this setup?

    I have already set up NAS hdd as connecting it at USB port of Airport Extreme, i also want to remotely access it from iPhone, so what's the next step? What are some of the best iOS apps can remotely played videos, audios, photos and text files from the NAS hdd and how to configure this setup?

    *Edit - I am not able to connect to the NAS when hardwired to the airport extreme.

  • Reading a text file from a URL

    I am having problems trying to read a text file from a URL.
    This is the code i have been using:
    package Java;
    import java.net.*;
    import java.io.*;
    public class Main_1 {
    public static void main(String[] args) throws Exception {
         URL myAddress = new URL("http://www.geocities.com/simonrobinson1/java/farrago.txt");
         BufferedReader in = new BufferedReader(
                        new InputStreamReader(
                        myAddress.openStream()));
         String inputLine;
         while ((inputLine = in.readLine()) != null)
         System.out.println(inputLine);
         in.close();
    but it returns an error saying:
    java.net.NoRouteToHostException: Operation timed out: no further information
    at java.net.PlainSocketImpl.socketConnect(Native Method) .....etc etc.
    Is this just a problem due to my network or is there something wrong with my code ????

    Altho you can access the file by typing the URL in a browser, geocities being a free web-hosting service don't like you to access the materials without seeing their ads. You have to find a way to trick it into thinking that you are indeed coming in from a web browser even tho you aren't.
    V.V.

  • Reading text file from database server in OA Page

    Hi Guys,
    I am trying to embed an applet with in an OA Page. The applet is used to mainly for showing Gantt chart. I have to pass my connection details from OA Page to applet, I dont pass directly the connection details to the applet so i am placing all the server details, user name and password in a text file on the database server.
    So from the OA Page i have to read the contents of the file on the database server and pass them to the applet using the <PARAM> tag. My question is how to read the text file from the database server.Any Inputs?
    Thanks in advance for your help.
    Regards,
    Nagesh Manda.

    If the file to be read is on the database, then it makes sense to use the pl/sql code to read the file. Make a call to this pl/sql code from page controller to get back the values.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                           

  • Download text file from application server to client server.

    Hi all,
    I am facing a format issue while downloading text file from application server to the client machine.
    The issue is that, say I have 6 to 10 lines in my text file in application server. but when i store it on the hard drive,
    it shoes all the data in a single line. Where as i need to download data in same format as in application server.
    Awaiting for your responses.
    Regards,
    Jose

    Hi,
    If we want to upload file data from the application server to the internal table, there is no function module or class static method which we can use, we must wirte the code by ourselves.
    1. For the file data which has no seperator between field columns.
    PARAMETERS p_file  TYPE dxfile-filename.
    START-OF-SELECTION.
    OPEN DATASET p_file IN TEXT MODE ENCODING DEFAULT FOR INPUT.
      DO.
        READ DATASET p_file INTO gds_data.
        IF sy-subrc <> 0.
          EXIT.
        ENDIF.
        APPEND gds_data TO gdt_data.
      ENDDO.
    CLOSE DATASET p_file.2. For the file data which has tab separator between field columns.
    DATA: gds_field_split type gts_data.
    FIELD-SYMBOLS: <fs_field> TYPE gts_data.
    PARAMETERS p_file  TYPE dxfile-filename.
    START-OF-SELECTION.
    OPEN DATASET prf_file IN TEXT MODE ENCODING DEFAULT FOR INPUT.
      DO.
        READ DATASET p_file INTO gds_field.
        SPLIT gds_field  AT cl_abap_char_utilities=>horizontal_tab
             INTO TABLE gdt_field_split.
       LOOP AT gdt_field_split  into gds_field_split.
           gdf_index = gdf_index + 1.
           ASSIGN COMPONENT gdf_index OF STRUCTURE
                 gds_data to <fs_field>.
          IF sy-subrc = 0.
              <fs_field> = gds_field_split.
          ENDIF.
       ENDLOOP.
        APPEND gds_data TO gdt_data.
      ENDDO.
    CLOSE DATASET p_file.
    Thanks & regards,
    ShreeMohan

Maybe you are looking for