Not able to read other than text files

Hi,
I am trying to read a set files in a folder, but i am able to read only test files all other file format cannot be read. word document is not read correctly!
I use fileInputstream object and get the bytes of the file length and set the charset to "UTF-8". the output is like a junk data.
I feel i need to set the exact charcterset, but donot no how, can any body help me out.
i tried character.unicodeblock.of this is not returning the exact uincode( may be i am wrong)
Thanks in advance.

Don't read binary files as though they were text.
Also if you are just copying files, you shouldn't even bother to read text files as text, unless you want to go beyond copying and, say, change the encoding.
[http://java.sun.com/docs/books/tutorial/essential/io/index.html]

Similar Messages

  • HT3775 I am using OS X Mountain Lion and I have this .avi file but not able to read. What is missing in my setup and what other file do I need to download to enable me to read?  I can read mp4 files though.

    I am using OS X Mountain Lion and I have this .avi file but not able to read. What is missing in my setup and what other file do I need to download to enable me to read?  I can read mp4 files though.

    Here is a link: https://itunes.apple.com/en/app/mplayerx/id421131143?mt=12
    I agree that VLC is also a good choice but MPlayerX is more user friendly.

  • TS2755 Ever since I updated my iphone 4 to 5.1.1, I am not able to send more than one picture at a time in a text message. Does anyone know how to fix this?

    Ever since I updated my iphone 4 to 5.1.1, I am not able to send more than one picture at a time in a text message. Does anyone know how to fix this?

    Yes, I know the photos stored on the device... But which app are you accessing the photos with? Which app do you want to be able to highlight more than one pic at a time in?
    There are literally thosands of apps that access the iOS Photo Library - which one(s) are you using?

  • PIX515 version 7.0 and router 2811 ver 12.3r8 not able to receive emails from gmail files larger than 2M

    PIX515 version 7.0 and router 2811 ver 12.3r8 not able to receive emails from gmail files larger than 2M

    MatejLach wrote:
    clamd is running, user and group clamav all have the relevant permissions as far as I can tell, however upon scanning my mail, I always end up with the following error:
    Scanning error:
    /home/username/.claws-mail/mimetmp/0000000e.mimetmp: lstat() failed: Permission denied. ERROR
    Seems like a permissions error to me... maybe check the actual file it is attempting to scan... I know it is in your home folder, but just to be sure, you might want to check that everything is sane.

  • Not able to read the wsdl file from server Premature EOF encounter

    Hi All,
    I am facing issue while accessing a web Service from server. Here is the clear view about it.
    I created a simple SyncBpel process in a composite and deployed in to the server and it is working fine. Later i created a new Asyn bpel process in a composite and in the external reference i dragged a web Service and imported the wsdl url from server of the SyncBpel and wired the Asynbpel process to webserive .
    Now here i am facing peculiar behavior which i am not able to trace it out.
    1) For the first time when i import the url of syncBpel from the server i am not facing any error and it is working fine as expected but when i close the Jdeveloper and open it i am not able to user the web Service and it is saying as "Not able to read the wsdl file from server Premature EOF encounter"
    2)When i close and open the Jdeveloper i can see the url of the wsdl which imported in webserver is changing from http://stcfmw03.satyam.com:8021/soa-infra/services/Tarak/synchronousBpel/bpelsync_client_ep?WSDL to http://stcfmw03.satyam.com:8021/soa-infra/services/Tarak/synchronousBpel/BPELsync.wsdl
    3)when I open and see the url http://stcfmw03.satyam.com:8021/soa-infra/services/Tarak/synchronousBpel/bpelsync_client_ep?WSDL I can see the soap address as *<soap:address location="http://stcfmw03.satyam.com:8021/soa-infra/services/Tarak/synchronousBpel!1.0*soa_5cfb8416-c106-40a2-a53b-9054bbe04b9c/bpelsync_client_ep"/>*
    I don’t understand why the soap end contains “*soa_5cfb8416-c106-40a2-a53b-9054bbe04b9c” and this kind of url for soap address is coming to all the bpel process which I am deploying in the server.
    I checked the in Jdeveloper where webproxy is uncheck and the server is also up but still I am facing issue of reading the error.
    Can someone please help in resolving the issue.
    I am using SOA 11g 11.1.1.5 and Jdeveloper 11.1.1.5
    Many thanks.
    Tarak
    Edited by: user11896572 on Jan 17, 2012 5:22 PM

    Hi,
    Setting default from the jdeveloper -
    During composite deployment from Jdeveloper (wizard driven), you will be given an option to choose the version of the composite and there will also be an option for you to choose if the composite needs to be deployed as default.
    Setting default from the em console -
    After deploying a composite, login to the em console and click on the composite that you want to set as default, and you will find a tab - "Set as Default". please note that this tab will not be seen, if the composite is already set as default.
    Refer -
    http://docs.oracle.com/cd/E12839_01/integration.1111/e10226/soacompapp_mang.htm
    8.2 Managing the State of Deployed SOA Composite Applications
    Thanks

  • 9.3.1- Not able to see more than 1 errors in application.log file

    Hi,
    In 9.3.1. version, I am not able to see more than 1 errors in application.log file during dataload without rules files.
    If anybody has faced this solution, pls let me know the cause.
    Thanks
    jazz

    Hey Jazz,
    in the first row add a rule file with no load file change the path to what you want. then insert a new row add your load file here. it should have the path from the previous row in the error file. Then delete the first row and run. I had to do this for a level zero load and was the only thing I could figure out so far

  • Mail does not recognize outgoing server for Forwards or content other than text

    Since installing Mountain Lion Mail has been erratic.  It generally will not send mail that I Forward nor will it send mail that includes links, graphics photos, etc.  It sends original mail consisting of text only without a problem.  When I try to Forward mail, or send new mail that includes content over and above text, I get the following result:
    None of the options will send the mail.   If I “Try With Selected Server”, I go into an endless loop – click on it, get the same Cannot Send… window back.  “Try Later” merely puts the message into my Outbox where it sits – and sits.  It will sit there for days if I let it.  If I sooner or later try to send it, I get the above Cannot Send… window again.  If I “Edit the Message”it still will not send. The Connection Doctor tells me that the mail account is logged in and connected without a problem.  If I “Edit SMTP Server List” I get Mail Preferences – the edit SMTP list window – and no SMTP servers listed – blank list.  Yet the Mail account has the proper iCloud SMTP server in its set-up.  Moreover, text only emails send without a hitch.  I can readily send them before, during and after the “Cannot Send…” window pops up for an email that has other than text included in its content.
    Interestingly, if I put the problem email into my Draft mailbox and then go online and log-in to my iCloud account, I can then open the email in iCloud online and send it – and it sends without a pause or quibble. Why won’t it send through Mail on my computer???
    NONE of this happened in Lion. 

    Some of the threads related to this one that I found (none provides a solution):
    On apple.com:
    * IMAP Folders (http://discussions.apple.com/message.jspa?messageID=6406947#6406947)
    * Exchange email folders and sub-folders: iPhone only pulling main "inbox" (http://discussions.apple.com/message.jspa?messageID=6406941#6406941)
    * IMAP - How to poll sub-folders (not GMAIL/Yahoo) (http://discussions.apple.com/message.jspa?messageID=6406940#6406940)
    * Mail not checking for new messages in IMAP subfolders (http://discussions.apple.com/message.jspa?messageID=6406938#6406938)
    * Imap Slow or not responsive (http://discussions.apple.com/message.jspa?messageID=6406937#6406937)
    * Iphone Mail Only Shows "Load X More Messages" (http://discussions.apple.com/thread.jspa?messageID=6407082#6407082)
    * IMAP: Only updates Inbox? (http://discussions.apple.com/thread.jspa?messageID=6407083#6407083)
    * Any way to get the mail app to get updated message counts for other folders (http://discussions.apple.com/thread.jspa?messageID=6407118#6407118)
    Elsewhere:
    * Help iphone mail subfolders IMAP (http://forums.macrumors.com/showthread.php?t=391027)

  • Why is PC MS Word is not able to read MSword files from MAC?

    Why is PC MS Word is not able to read MSword files from MAC?

    What version of Word is on the PC?
    What version of Word is on the Mac?
    What sort of error message or other bad behavior do you observe?

  • Reading mime types other than text

    Is there a way to parse out text from mime types (other than text). I am using the following code for getting content of emails but it gives a "class not found exception" when the email content is something other than pure ascii text or if the email has attachments.
    Message messages[]=folder.getMessages();
    int nummessages=folder.getMessageCount();
    System.out.println((String)((MimeMessage)messages[nummessages-1]).getContent()).
    Also can anyone provide any direction on how to seperate out the mail body from attachments.
    thanks for any help
    ronjon

    Hi!
    Maybe the following is helping...
    First call: this.processEvaluateContenttype(((MimeMessage)messages[nummessages-1]).getContent());
         protected void processEvaluateContenttype(Object aObject){
              try{
                 if(aObject instanceof Multipart){
                     Multipart aMultiContent = (Multipart) aObject;
    //                    Traverse every part of the multipart-content...                         
                        for(int contentIndex=0; contentIndex < aMultiContent.getCount(); contentIndex++){
                             this.processEvaluateContenttype(aMultiContent.getBodyPart(contentIndex));                       
                 }else if(aObject instanceof BodyPart){
                     BodyPart aBodyContent = (BodyPart) aObject;                                 
                        StringTokenizer aTypeTokenizer = new StringTokenizer(aBodyContent.getContentType(), "/");
                        String abstractType = aTypeTokenizer.nextToken();                     
                        if(abstractType.equals("MESSAGE") || abstractType.equals("message")){
                             Message inlineMessage = (Message)aBodyContent.getContent();        
                             this.processEvaluateContenttype(inlineMessage.getContent());
    //                    Specific tryouts....
                        }else if(abstractType.equals("APPLICATION") || abstractType.equals("application")){
    //                         Get name of attachment...
                             String fileName = aBodyContent.getFileName();     
    //                         Check name of attachment...
                             if((null != fileName)
    //                                      do somthing
             }catch(Exception ex){
                  super.errorManager.handleError("MailBot | Task_ContractState", ex);
                   super.isResponsible.isResponsible = false;
         }     This method is in daily use and works fine... The "abstractType" you are looking for is bw "TEXT" and "text":

  • Reading through a text file and then sorting

    I'm having a lot of problems with this.
    I have to read through a text file and I have to split the string up so that it is seperated into individual tokens. A line from the text file looks like this. addEvent(new Bell(tm + 9000)). I have to grab the addEvent, new, Bell, tm and 9000 and store it in a linkedlist. After reading through the whole text file I have to sort the the linked list based on the number. ie: 9000. Is there any way to do this? I currently break up the text file using a StringTokenizer object but then i am uncertain on how to add it to a linked list and then sort each line based on the number. Any help would be appreciated.
    Joe

    Sorry to bother you Ben but I just can't get my head wrapped around this. Here is exactly what I have to do:
    After reading, Events must be stored in the EventSet according to the time they are to occur. Assume that no time number is more than 8 digits long. Restart() must be able to deal appropriately with any order of the Events. To accomplish this have Restart() save the relevant Event information in an LinkedList of strings and sort the Events by time before adding each event to EventSet. Use the <list>.add() to set up your linked list. This is shown in c09:List1.java and Collections.sort(<list>) shown in c09:ListSortSearch. Modify the Bell() to output a single "Bing!". When you read in a Bell event generate the appropriate number of Bell events as indicated by rings. These must be set to the correct times. This is an alternative to generating the new Bell events within Bell(). It will allow them be sorted into their correct time sequence. At this point the output of the program should be identical the original program.
    After the intitial start, when restarting Restart() must provide to the user the option to recreate the EventSet from the linked list or read in a new file (supplied by the user). This must be achieved by prompting the user at the console. Please also allow the user the option to quit the program at this stage.
    Main Program Code:
    public class GreenhouseControls extends Controller
    private boolean light = false;
    private boolean water = false;
    private String thermostat = "Day";
    private boolean fans = false;
         private class FansOn extends Event
              public FansOn(long eventTime)
                   super(eventTime);
              public void action()
              // Put hardware control code here to
              // physically turn on the Fans.
              fans = true;
              public String description()
                   return "Fan is On";
         private class FansOff extends Event
              public FansOff(long eventTime)
                   super(eventTime);
              public void action()
              // Put hardware control code here to
              // physically turn off the Fans.
              fans = false;
              public String description()
                   return "Fans are Off";
         private class LightOn extends Event
              public LightOn(long eventTime)
                   super(eventTime);
              public void action()
                   // Put hardware control code here to
                   // physically turn on the light.
                   light = true;
              public String description()
                   return "Light is on";
         private class LightOff extends Event
              public LightOff(long eventTime)
                   super(eventTime);
              public void action()
                   // Put hardware control code here to
                   // physically turn off the light.
                   light = false;
              public String description()
                   return "Light is off";
         private class WaterOn extends Event
              public WaterOn(long eventTime)
                   super(eventTime);
              public void action()
                   // Put hardware control code here
                   water = true;
              public String description()
                   return "Greenhouse water is on";
         private class WaterOff extends Event
              public WaterOff(long eventTime)
                   super(eventTime);
              public void action()
                   // Put hardware control code here
                   water = false;
              public String description()
                   return "Greenhouse water is off";
         private class ThermostatNight extends Event
              public ThermostatNight(long eventTime)
                   super(eventTime);
              public void action()
                   // Put hardware control code here
                   thermostat = "Night";
              public String description()
                   return "Thermostat on night setting";
         private class ThermostatDay extends Event
              public ThermostatDay(long eventTime)
                   super(eventTime);
              public void action()
                   // Put hardware control code here
                   thermostat = "Day";
              public String description()
                   return "Thermostat on day setting";
         // An example of an action() that inserts a
         // new one of itself into the event list:
         private int rings;
         private class Bell extends Event
              public Bell(long eventTime)
                   super(eventTime);
              public void action()
                   // Ring every 2 seconds, 'rings' times:
                   System.out.println("Bing!");
                   if(--rings > 0)
              addEvent(new Bell(System.currentTimeMillis() + 2000));
              public String description()
                   return "Ring bell";
         private class Restart extends Event
              public Restart(long eventTime)
                   super(eventTime);
              public void action()      
                   long tm = System.currentTimeMillis();
                   // Instead of hard-wiring, you could parse
                   // configuration information from a text
                   // file here:
              try
              BufferedReader in = new BufferedReader(new FileReader("Event Config.txt"));
              String str;
                   String[] l1 = new String[5];
                   LinkedList l2 = new LinkedList();
              while((str = in.readLine()) != null )
                        StringTokenizer st = new StringTokenizer(str, "(+); ");
                        int nIndex = 0;
                        while (st.hasMoreTokens())
                             l1[nIndex] = st.nextToken();
                        //System.out.println(st.nextToken());
                             nIndex++;
                        l2.add(l1);
                   String[] s1 = (String[])l2.get(1);
                   for(int i = 0; i < s1.length; i++)
                        System.out.println(s1);
                   Comparator comp = s1[4];
                   Collections.sort(l2, comp);
              in.close();
              catch (IOException e)
    rings = 5;
    addEvent(new ThermostatNight(tm));
    addEvent(new LightOn(tm + 1000));
    addEvent(new LightOff(tm + 2000));
    addEvent(new WaterOn(tm + 3000));
    addEvent(new WaterOff(tm + 8000));
    addEvent(new Bell(tm + 9000));
    addEvent(new ThermostatDay(tm + 10000));
    // Can even add a Restart object!
    addEvent(new Restart(tm + 20000));*/
    public String description() {
    return "Restarting system";
    public static void main(String[] args) {
    GreenhouseControls gc =
    new GreenhouseControls();
    long tm = System.currentTimeMillis();
    gc.addEvent(gc.new Restart(tm));
    gc.run();
    } ///:~
    Examples File:
    addEvent(new ThermostatNight(tm));
    addEvent(new Bell(tm + 9000));
    addEvent(new Restart(tm + 20000));
    addEvent(new LightOn(tm + 1000));
    addEvent(new WaterOn(tm + 3000));
    rings = 5;
    addEvent(new FansOn(tm + 4000));
    addEvent(new LightOff(tm + 2000));
    addEvent(new FansOff(tm + 6000));
    addEvent(new WaterOff(tm + 8000));
    addEvent(new WindowMalfunction(tm + 15000));
    addEvent(new ThermostatDay(tm + 10000));
    EventSet.java Code:
    // This is just a way to hold Event objects.
    class EventSet {
    private Event[] events = new Event[100];
    private int index = 0;
    private int next = 0;
    public void add(Event e) {
    if(index >= events.length)
    return; // (In real life, throw exception)
    events[index++] = e;
    public Event getNext() {
    boolean looped = false;
    int start = next;
    do {
    next = (next + 1) % events.length;
    // See if it has looped to the beginning:
    if(start == next) looped = true;
    // If it loops past start, the list
    // is empty:
    if((next == (start + 1) % events.length)
    && looped)
    return null;
    } while(events[next] == null);
    return events[next];
    public void removeCurrent() {
    events[next] = null;
    public class Controller {
    private EventSet es = new EventSet();
    public void addEvent(Event c) { es.add(c); }
    public void run() {
    Event e;
    while((e = es.getNext()) != null) {
    if(e.ready()) {
    e.action();
    System.out.println(e.description());
    es.removeCurrent();
    } ///:~
    Event.java Code
    abstract public class Event {
    private long evtTime;
    public Event(long eventTime) {
    evtTime = eventTime;
    public boolean ready() {
    return System.currentTimeMillis() >= evtTime;
    abstract public void action();
    abstract public String description();
    } ///:~
    Is this problem easier than I think it is? I just don't know what to add to the linkedList. A LinkedList within a linkedList? I find this problem pretty difficult. Any help is muchly appreciated.
    Joe

  • SQL Developer is not able to identify the Tnsnames.ora file

    Hi,
    I have installed the following in the laptop having Win XP:
    1) Oracle 10gR2 Client software in the D: drive of laptop. Tnsnames.ora is located in this clients Network\Admin path. This client is used to access the databases on the other servers.
    2) Oracle 10gR2 Database software in the E: drive of laptop. Right now there is not Tnsnames.ora file in this softwares Network\Admin path. This db software has been installed to create local databases in the laptop.
    3) Oracle SQL Developer Version 2.1.1.64 is also installed in C: drive of laptop.
    The problem which now I'm facing is that the SQL Developer is not able to identify the Tnsnames.ora file mentioned in the above point-1 which contains entries of databases on the different servers. Could you please help me out in solving this problem?
    Thanks in advance.
    MAK

    I forget what version I was using at the time, but when I had an ORACLE_HOME defined for the environment and TNSNAMES file defined in SQL Developer (different one than was in ORACLE_HOME), that I would see results from both tns files. I don't know if that is still the case. I have since dropped my ORACLE_HOME environmental variable.

  • Help needed regarding reading in a text file and tokenizing strings.

    Hello, I require help with a task I've been set, which asks me to read in a text file, and check the contents for errors. The text file contains lines as follows.
    surname:forename:1234:01-02-06
    I can read in the file, but dont know how to split the strings so each token can be tested (ie numbers in the name tokens)
    However, I am not allowed to use regex functions, only those found in java.io.*
    I think i should be putting the tokens into an array, but have had no luck so far in doing so. Any help would be appreciated.

    public class Validator {
         public static void main(String args[]) {
              String string = "Suname:Forename:1234:01_02-06";
              String stringArray[] = string.split(":");
              System.out.println (validateLetters(stringArray[0]));//returns true
              System.out.println (validateNumbers(stringArray[3]));//returns false
         static boolean validateLetters(String s) {
                 for(int i = 0; i < s.length(); i++) {
                 char c = s.charAt(i);
                 if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z')) {
                         return false; //return false if one of characters is other than a-z A-Z
                 }//end if
                 }//end for
                 return true;
         }//end validateLetters
         static boolean validateNumbers(String s) {
                 for(int i = 0; i < s.length(); i++) {
                 char c = s.charAt(i);
                 if ((c < '0' || c > '9') && (c != '-')) {
                         return false; //return false if one of characters is other than 0-9 or -
                 }//end if
                 }//end for
                 return true;
         }//end validateNumbers
    }

  • How ALBPMEngine logs can be read other than using log viewer

    Dear Friends,
    Can anybody help on How ALBPMEngine logs can be read other than using log viewer?
    Look forward for rsponse.
    cheers

    Max Meilleur wrote:
    Mark,
    I would be interested in knowing how you can decouple the obpmlogviewer.exe app from the OBPM Enterprise installation.
    How can I send a simple .zip file to others and tell them: "hey, unzip (or install) this only and you will be able to read OBPM engine logs files on your local machine" ?
    The logViewer executable can't be run without an enterprise install (at least not easily decoupled), however, an alternative, would be to pass someone the .jnlp and some log files.... To do this, open up the process admin, and in the top right, is a link for 'Launch Log Viewer'. Open that, and then go to 'File - Save As', and this will save a java executable to your computer.
    I'm pretty sure you can pass that, and either an admin user and password to view 'live' logs, or just have them cancel the remote log, and open a local file....
    Adam,
    PS: I don't see any opbmlogreader.exe or .sh or .bet in the OBPM_HOME\bin directory. I am looking at OBPM standalone, and the only relevant files I can see are obpmlogviewer.exe , obpmlogviewer.lax , lax.jar. Am I missing something?
    MaxI too don't have the log reader, however I do remember it... I'm thinking the .sh might only be included in the linux distribution of enterprise, so I'm downloading that now to verify... I will let you know what I find...
    HTH,
    -Kevin

  • How to read a whole text file into a pl/sql variable?

    Hi, I need to read an entire text file--which actually contains an email message extracted from a content management system-- into a variable in a pl/sql package, so I can insert some information from the database and then send the email. I want to read the whole text file in one shot, not just one line at a time. Shoud I use Utl_File.Get_Raw or is there another more appropriate way to do this?

    how to read a whole text file into a pl/sql variable?
    your_clob_variable := dbms_xslprocessor.read2clob('YOUR_DIRECTORY','YOUR_FILE');
    ....

  • HOW TO WRITE AND READ FROM A TEXT FILE???

    How can I read from a text file and then display the contents in a JTextArea??????
    Also how can I write the contents of a JTextArea to a text file.
    Extra Question::::::: Is it possible to write records to a text file. If you have not idea what I am talking about then ignore it.
    Manny thanks,
    your help is much appreciated though you don't know it!

    Do 3 things.
    -- Look through the API at the java.io package.
    -- Search previous posts for "read write from text file"
    -- Search java.sun.com for information on the java.io package.
    That should clear just about everything up. If you have more specific problems, feel free to come back and post them.

Maybe you are looking for