Using FileInputStream to view File Details.

Hi,
I am unable to view the contents of this XML file
using FileInputStream.It doest display anything at all.
Am I missing anything? Can someone please help?
File f = new File("C:/Order.xml");
FileInputStream fis = new FileInputStream(f);
StringBuffer sb = new StringBuffer();
byte b[] = new byte[1];
int line;
        while ((line = fis.read())!= -1)
            sb.append(new String(b));
        System.out.println(sb.toString());

import java.io.*;
public class FullyReadAFile
    static public byte[] readFully(String source) throws IOException
        return readFully(new File(source));
    static public byte[] readFully(File source) throws IOException
        final DataInputStream dis = new DataInputStream(new BufferedInputStream(new FileInputStream(source)));
        final byte[] buffer = new byte[(int)source.length()];
        dis.readFully(buffer);
        dis.close();
        return buffer;
    static public String readFullyAsString(String source, String fileEncoding) throws IOException, UnsupportedEncodingException
        return readFullyAsString(new File(source), fileEncoding);
    static public String readFullyAsString(File source, String fileEncoding) throws IOException, UnsupportedEncodingException
        return new String(readFully(source), fileEncoding);
    public static void main(String[] args) throws Exception
        final String fileContent = readFullyAsString(System.getProperty("user.home") + "/user.sql", "UTF-8");
        System.out.println(fileContent);
}

Similar Messages

  • Can I use Bridge to view files in Google Drive?

    Is there any way to use Bridge to view files that are in a shared Google Drive folder?

    Have you searched for it using the Spotlight? That's the loop icon on the right side of the upper menu bar.

  • How do I use Finder to modify file details in multiple files

    I am new to the mac (OS10.7.4) having recently transitioned from Windows (and go way back to CPM - for those that remember).  I am trying to achieve through finder what I can do in windows explorer by selecting multiple files, selecting  properties and then selecting (and then modifying) details.  I tried the similar thing on Finder using Get Info instead of Properties but only ended up with multiple windows, one for each file selected (and had to close each one individually! ).  Tried 'option-command-I' on multiple selected files, it worked, but the common tags that I wanted to alter where not available for editing.  I can simply, but clumsily, achieve the outcome I want by cutting and pasting the files to a usb stick, making the modifications on the windows machine and pasting them back on the mac.     This should be a simple basic operating system function regardless of platform - advice on how to find/achieve it appreciated!

    I find it best to use small little apps to help modify many files. Just serach for what you want to change and more often then not, you find software that does what you need, often free too.
    For Music tags: check out the free program "TriTag" to do what you want:
    http://www.feedface.com/projects/tritag.html
    For Music conversion (say, from FLAC to Apple Lossless) or MP3 to whatever... Use "XLD" (free)
    http://download.cnet.com/X-Lossless-Decoder/3000-2140_4-189505.html
    Bonus: VLC (free download) - has the ability to convert wma audio files, which is amazing, it's rare to find mac software that will convert wma to mp3 - http://9thport.net/2010/07/28/using-os-x-to-convert-wma-to-mp3-for-free/
    For file renaming in batch, I use "Name Mangler" - 10 bucks, app store.
    It has a lot of pro features and is very useful.
    good luck.
    - James

  • View file details in labview 8.0

    hi
    i can list all the files in  a drive.. but i need to collect the size and date modification in the list. how to get it?
    Please help
    Solved!
    Go to Solution.

    Hi, 
    You can use File I/O>>Advanced File Functions>>File/Directory Info to get the file size and date modification.

  • Do I need to have iWork on my iOS device in order to view files that are stored in iCloud Drive?

    I was hoping that iCloud Drive would allow us to view files on our iPhones or iPads without having Pages, Numbers, or even Word, Excel, etc... When I did the update to iOS 8 I found that there was no separate app for iCloud Drive, thus no way to simply view files stored on iCloud Drive.  I understand not being able to edit the files without having iWork or Office programs installed.  Does anyone know if we will have this capability or if I'm just missing it?  If this option isn't going to be provided to us, I'll be forced to continue to use Dropbox to view files on iOS devices (even though we can't view iWork files on iOS Dropbox anymore...)

    To elaborate on my question, this is what I was expecting.  The iPad and iPhone in this picture looks as though there is a place on iOS where you can see all of the files that are located in iCloud Drive.  You can also see that each file has an associated tag (the colored dots) which we were able to start using on Mavericks.  I understand that the Mac you see in the picture has iCloud Drive as a native(ish) drive on the computer which will be available with Yosemite, but I don't understand where on the iPhone/iPad these shots were taken from, assuming it's iOS 8.0
    On the up side, I just received my iPhone 6 today to find that iPhone6 and 6+ users are given Pages, Numbers, and Keynote free for their iOS devices.

  • Use Access Snapshop vierer files on mac

    Does any one know how to open and use Access Snapshot Viewer files on a mac

    There isn't a way to read Access Snapshot files on the Mac. Even though they're called snapshot files, they aren't graphics. A snapshot file is just an Access report exported in a binary format that can be viewed with a lightweight viewer so Windows users don't need to have the full blown Access application installed.
    If you have the use of a Windows computer you could try installing the viewer and then opening the file and exporting it to PDF so it is viewable on the Mac.

  • Cant open PDF files..It says the adobe acrobat reader that is running can not be used to view files in a browser..plz suggest the solution.thanks

    Whenever i try to open a PDF file it says " The adobe/acrobar reader that is running can not be used to view files in a web browser. Plz exit adobe/acrobat readerand exit your web browser and try again." Wt do i need to do, plz suggest.
    Regards
    Aditya Bhargava

    Hi adityabhargava01-
    My first suggestion is to upgrade to the most recent version of Firefox by going to this link:
    http://www.mozilla.org/en-US/firefox/new/
    My second suggestion is to read this article on how to many your preferences on how Firefox deals with PDFs and all other file types:
    [[Options window - Applications panel]]
    I hope that helps!

  • After upgrading to ios6 my iphone will not open .xls files in emails with the default viewer. Is there a fix for this? The same emailed .xls files still open on my ipad using ios5 while viewing email like they did on my iphone prior to upgrading.

    After upgrading to ios6 my iphone will not open .xls files in emails with the default viewer. Is there a fix for this? The same emailed .xls files still open on my ipad using ios5 while viewing email like they did on my iphone prior to upgrading. I have no special software like numbers or anything else installed on either device. Just using the default viewer provided by apple for viewing email.

    The attachment is an .xls excel 97-2003 spreadsheet. I viewed the file in the email and did not edit it with any software. I can forward the file to anyone that is may want to check it out to see if they can help me. I was wondering if there was some way of forcing another ios6 install on my phone and maybe that would solve it.
    Is there anyone out there that is viewing .xls files in email using ios6 w/o any other software installed like numbers or any other add ons? I am not upgrading my ipad from ios5 to ios6 so I can still continue to view the emails on my ipad. Is there an email viewer .xls plug-in that will be availablle in the next ios6 update?

  • How can I display pdf file details on 64-bit Windows 7 detail view?

    I'd like to display some pdf file details in order to classify them by author, title, subject... This option was simply possible for pdf file on windows xp (just by selecting the desired details on detail view when exploring folders) but it seems to be impossible for windows 7 (It's possible for other file like *.jpg, mp3...). Is there a program or a plugin to solve this problem? Thank you very much.

    It would appear, very annoyingly, that Acrobat is still lagging in the x64 department! It will, at the moment, only run as an x86 sub.....

  • Can't read a file using FileInputStream(String path)

    Hi,
    Platform: Fedora Core 3
    IDE: MyEclipse 3.8.1
    Servlet Container: Tomcat 5
    Framework: Struts 1.1
    JDK: 1.5
    1) I'm trying to read a file (mw.properties) which resides in the package aaa.ccc.uuu.struts using FileInputStream("/aaa/ccc/uuu/struts/mw.properties");
    The class (named MyAction) trying to read this file is in the following package
    aaa.ccc.uuu.struts.actions.MyAction
    2) The alternatives that I've tried is:
    a) FileInputStream("aaa/ccc/uuu/struts/mw.properties");
    b) FileInputStream("aaa/ccc/uuu/struts/mw.properties");
    c) FileInputStream("/mw.properties");
    d) FileInputStream("mw.properties");
    (/javaweb is the context path)
    e) FileInputStream("/javaweb/WEB-INF/classes/aaa/ccc/uuu/struts/mw.properties");
    f) FileInputStream("/classes/ccc/uuu/struts/mw.properties");
    g) FileInputStream("classes/aaa/ccc/uuu/struts/mw.properties");
    h)FileInputStream("/usr/local/jakarata-tomcat-5/webapps/javaweb/aaa/ccc/uuu/struts/mw.properties");
    i) FileInputStream("/WEB-INF/classes/aaa/ccc/uuu/struts/mw.properties");
    ...and so forth.
    3) My Tomcat directory structure looks like the following:
    javaweb
    -->src
    ---->aaa
    ------>ccc
    --------->uuu
    ------------>struts/mw.properies
    --------------->actions/MyAction.java (trying to read the mw.properties file from within this file)
    -->web
    --->WEB-INF
    ----->classes
    --------->aaa
    ------------>ccc
    ---------------->uuu
    ------------------->struts/mw.properties
    ----------------------->actions
    --------------------------->MyAction.class (I've placed the mw.properties file here as well)
    ----->jsp
    ------>some more folders
    Note that the mw.properties file is in the source directory as well as the classes directory - I did this to trouble shoot. As far as i know the correct place to put the mw.properties file is in the classes folder (taking into consideration the package structure obviously)
    I'll appreciate any help I'm really stumped! (Not sure if this is the correct forum to post this query)
    Cheers

    Hi,
    My knowledge about web applications is very limited. I would try to create a new file from the app using just a name, and not a path. I would then look for the created file to see where the current path is. But I guess you could figure it out by reading the documentation.
    /Kaj

  • I have a document made up of separate PDF files which reside in a folder and are linked to each other via hyperlinks. Each pdf file is set to open with bookmarks displayed, however if I link from one PDF file to another and use the "Previous View" button

    I have a document made up of separate PDF files which reside in a folder and are linked to each other via hyperlinks. Each pdf file is set to open with bookmarks displayed, however if I link from one PDF file to another and use the "Previous View" button to navigate back to my starting point the bookmarks are replaced by "page thumbnails". Is there anyway to stop this from happening?

    Hi Pusman,
    While setting up the links, if you choose to open the file in a new window then you won't face this issue, then you can simply switch to the previous file and bookmark view will remain as it is.
    Does that helps with your query?
    Regards,
    Rahul

  • Can i still use Fast Web View for PDF/A files?

    Can i still use Fast Web View for PDF/A files?
    In other words, just becasue I am using PDF/A, can I still select the page i need in a long document and see it before the entire file has loaded?

    macjack has a very valid point, so you might want to consider a second drive for files.
    To partition, you need to boot into the Recovery Volume (command - R) on restart. Select Disk Utility.
    Step 1 - select the hard drive.
    Step 2 - select the Partition tab.
    Step 3 - select the current partition and then use the lower right corner to push up and resize the partition.
    Step 4 - click the plus sign to add a partition. Then select the new partition.
    Step 5 - Name the new partition and select the format. The one shown in the screen shot is generally recomended.
    Step 6 - Hit apply.
    This procedure can be reversed at a later date if you find your Time Machine backup needs more space.

  • How to view file from vss using java Commandline

    Hi To ALL,
    I wanted to view a file from vss through java code.
    By using the folowing code,i could able to get vss file in to local folder.
    Runtime.getRuntime().exec
    ("cmd /c ss Get $/Mywork/Myfile.java -GLC:/New");
    But i wanted to view file from vss using java code.
    any one please help me..
    Thanks in advance.........

    As always, Google is your friend.
    Follow the bouncing link.
    http://www.google.com/search?hl=en&q=VisualSourceSafe+%2B+Java+API
    PS.

  • I want to use preview to view pdf files without trashing the adobe plug-ins?

    Some of the government web sites that I need to visit regularly require me to use firefox and adobe for opening and viewing files. I would like to still be able to use Safari and Preview for opening, viewing and printing files from other web sites. Before the latest adobe update this was no problem, but now Adobe seems to have taken control over the viewing and printing settings so that even though I try printing from a Safari viewer window I get an Adobe message that this is not supported. I tried to search for an answer as I suppose I am not the only one having this problem after the most recent Adobe update. Thanks for your great help everyone. /Christian

    See if either of these help you.
    https://support.mozilla.com/en-US/kb/Using+the+Adobe+Reader+plugin+with+Firefox
    https://support.mozilla.com/en-US/kb/Opening+PDF+files+within+Firefox

  • How to view waveforms in DIAdem that were saved in Labview using "write waveforms to file" VI

    I'm new to DIAdem but would appreciate any help to my question.
    I seem to be having a little trouble but how do I view waveforms
    in DIAdem that were saved in Labview using "write waveforms to file" VI??
    tks, Terry

    Hello,
    There are several ways to write waveform data from LabVIEW so it can be accessed from DIAdem. Two of the easiest ways are to use either .lvm files or .tdm files. You can write .lvm files using the Write LabVIEW Measurement File.vi which is located in the File I/O palette. You can write .tdm files by using the storage VIs which are located in the File I/O >> Storage palette. So, I would recommend using either of these file formats if you are developing a new application since these can be loaded into DIAdem directly.
    If you are interested in loading files that where already created from the Write Waveforms to File.vi, I am wondering what file type you are using. For example are you saving your files as .dat or .txt with your Write Waveforms to File.vi? Feel free to reply to this thread with this information and I would be glad to help you out.
    Regards,
    Kevin L.
    Applications Engineer
    National Instruments

Maybe you are looking for