Wrong file/data size in Wave Header

Hi all,
I record audio from the Mic into a byteArrayOutputStream and afterwards like to store it in a file. This is the main code:
     private void sendAudio() {
               byte audioData[] = byteArrayOutputStream.toByteArray();
               AudioInputStream ais = new AudioInputStream(new ByteArrayInputStream(audioData), getAudioFormat(), audioData.length);
               File file = new File("d:\\test.wav");
               AudioSystem.write(ais, AudioFileFormat.Type.WAVE, file);
     private AudioFormat getAudioFormat() {
          float sampleRate = 8000.0F;
          int sampleSizeInBits = 16;
          int channels = 1;
          boolean signed = true;
          boolean bigEndian = false;
          return new AudioFormat(sampleRate, sampleSizeInBits, channels, signed, bigEndian);
     }If i use a sampleSize of 8bits the generated wave file is fine. But when I use 16bit the size specified in the riff chunk and data chunk is wrong. It is twice the size it should be. I looked it up in the source code and it looks like the calculated sizes are mulitplied with the number of bytes of one sample. This works fine for 8 bits (num=1) but doesn't work for 16 bits (num=2).
Windows Media Player refuses to play the 16bit wav file. After correcting the size values (basically dividing the size without header by 2) the files are played fine.
Is it a bug in the WaveFileWriter Implementation or did I forget to specify a parameter somewhere.
Any help appreciated,
Jan

I found it.
You need to specify the number of samples when construction the AudioInputStream. I passed the length of the audioData, which is wrong:
//wrong
AudioInputStream ais = new AudioInputStream(new ByteArrayInputStream(audioData), getAudioFormat(), audioData.length);
/right
AudioInputStream ais = new AudioInputStream(new ByteArrayInputStream(audioData), getAudioFormat(), audioData.length / (sampleRate / 8) );

Similar Messages

  • Wrong file date on time capsule

    Hi every body
    When I copy a file to time capsule the file will have a totaly wrong file date.
    What is there the problem?
    Cheers Andy

    Hi every body
    The issue is solved. I recognized that I don't have the problem from my macbooc. So I restarted the imac. And the issue was solved :-).
    Cheers Andy

  • Loading wave file data into array

    Greetings
    For starters, I'm still learning java, so forgive me if this is a trivial question. I've been using the documentation on the java sound api as a guide. What I am trying to do is to load a wav file data into a byte array and eventually I will need it to have it in an int array so I can pass the data into a demodulation algorithm to display as an image. This wave file is a recorded signal from a NOAA satellite. Here is my code thus far:
    public boolean loadFile(File soundFile) {
              int totalFramesRead = 0;
              boolean result=false;
              File fileIn = new File(soundFile.getPath());
              try {
                   AudioInputStream ais = AudioSystem.getAudioInputStream(soundFile);
                   int bytesPerFrame = ais.getFormat().getFrameSize();
                   // Set an arbitrary buffer size of frames.
                   int numBytes = 1024*bytesPerFrame;
                   byte[] audioByte= new byte[numBytes];
                   try {
                        int numBytesRead = 0;
                        int numFramesRead = 0;
                        // Try to read numBytes bytes from the file.
                        while ((numBytesRead = ais.read(audioByte)) != -1) {
                             // Calculate the number of frames actually read.
                             numFramesRead = numBytesRead / bytesPerFrame;
                             totalFramesRead += numFramesRead;
                             return(result= true);
                   } catch (Exception ex) {
                   JOptionPane.showMessageDialog(desk, " Error Loading File" ,"Error",
                             JOptionPane.WARNING_MESSAGE);
                   ais.close();
                   throw ex;}
              } catch (Exception ex) {
                   JOptionPane.showMessageDialog(desk, " Error Loading File" ,"Error",
                             JOptionPane.WARNING_MESSAGE);
              return result;
         }

    You can find oracle documentation for sqlldr (11g) here:
    http://docs.oracle.com/cd/B28359_01/server.111/b28319/ldr_concepts.htm#SUTIL003
    If you have questions on details you should post your question in the special sqlldr forum:
    Export/Import/SQL Loader & External Tables
    hm

  • Backup MaxDB 7.6 mit HP Data Protector; Wrong file type

    Hallo.
    Wir versuchen, eine MaxDB-Datenbank (Rel. 7.6) auf SUSE-LINUX unter Verwendung von HP Data Protector zu sichern. Der Versuch, das Backup durchzuführen, schlägt fehl, da auf dem MaxDB-Server anscheinend die Pipe nicht angelegt werden kann. Folgende Meldung wird ausgegeben:
    From: BSM-hph3000.thebis.de "Content_sdb_sdba"  Time: 26.04.2008 10:19:16
          OB2BAR application on "dell2950.thebis.de" successfully started.
    From: OB2BAR_SAPDBBAR-dell2950.thebis.de "SDB"  Time: 04/26/08 10:16:22
          Executing the dbmcli command: `user_logon'.
    From: OB2BAR_SAPDBBAR-dell2950.thebis.de "SDB"  Time: 04/26/08 10:16:22
          Executing the dbmcli command: `dbm_configset -raw set_variable_1 OB2OPTS="(null)"'.
    From: OB2BAR_SAPDBBAR-dell2950.thebis.de "SDB"  Time: 04/26/08 10:16:22
          Executing the dbmcli command: `dbm_configset -raw set_variable_2 OB2APPNAME=SDB'.
    From: OB2BAR_SAPDBBAR-dell2950.thebis.de "SDB"  Time: 04/26/08 10:16:22
          Executing the dbmcli command: `dbm_configset -raw set_variable_3 OB2BARHOSTNAME=dell2950.thebis.de'.
    From: OB2BAR_SAPDBBAR-dell2950.thebis.de "SDB"  Time: 04/26/08 10:16:22
          Executing the dbmcli command: `dbm_configset -raw set_variable_4 TimeoutWaitFiles=30'.
    From: OB2BAR_SAPDBBAR-dell2950.thebis.de "SDB"  Time: 04/26/08 10:16:22
          Executing the dbmcli command: `dbm_configset -raw BSI_ENV /usr/omni/tmp/SDB.bsi_env'.
    From: OB2BAR_SAPDBBAR-dell2950.thebis.de "SDB"  Time: 04/26/08 10:16:22
          Executing the dbmcli command: `medium_put BACKDP-Data[1]/1 /usr/omni/tmp/SDB.BACKDP-Data[1].1 PIPE DATA 0 8'.
    From: OB2BAR_SAPDBBAR-dell2950.thebis.de "SDB"  Time: 04/26/08 10:16:22
          Executing the dbmcli command: `util_connect'.
    From: OB2BAR_SAPDBBAR-dell2950.thebis.de "SDB"  Time: 04/26/08 10:16:22
          Executing the dbmcli command: `backup_start BACKDP-Data[1] DATA'.
    From: OB2BAR_SAPDBBAR-dell2950.thebis.de "SDB"  Time: 04/26/08 10:16:23
          Error: SAPDB responded with:
          -24988,ERR_SQL: SQL error
          -903,Host file I/O error
          3,Data backup failed
          1,Backupmedium #1 (/usr/omni/tmp/SDB.BACKDP-Data[1].1) Wrong file type
          6,Backup error occured, Errorcode 3700 "hostfile_error"
          17,Servertask Info: because Error in backup task occured
          10,Job 1 (Backup / Restore Medium Task) WaitingT131 Result=3700
          6,Error in backup task occured, Errorcode 3700 "hostfile_error"
    From: OB2BAR_SAPDBBAR-dell2950.thebis.de "SDB"  Time: 04/26/08 10:16:23
          Executing the dbmcli command: `exit'.
    From: BSM-hph3000.thebis.de "Content_sdb_sdba"  Time: 26.04.2008 10:19:18
          OB2BAR application on "dell2950.thebis.de" disconnected.
    From: BSM-hph3000.thebis.de "Content_sdb_sdba"  Time: 26.04.2008 10:19:18
          None of the Disk Agents completed successfully.
          Session has failed.
    Ein Versuch, die Pipe /usr/omni/tmp/SDB.BACKDP-Data[1].1 manuell auf dem MaxDB-Server anzulegen, schlug ebenso fehl. Eine Pipe /usr/omni/tmp/SDB.BACKDP-Data kann angelegt werden.
    Frage 1) Hat jemand ein ähnliches Problem und dazu eine Lösung?
    Frage 2) Wo ist hinterlegt, welchen Medium-Name der Data Protector beim command "medium_put" verwenden soll?
    Danke für Eure Hilfe!
    Gruß
    Gerhard Krauß
    Heidelberg

    Hi Marcus,
    we use the version 5.5.
    The pipe name is generated by the Data Protector. When I want to create manually a pipe with this name I got the message "No hit found".
    Do you know a  possibilty where we can configure (at Data Protector or MaxDB) which medium name should be used for creating the pipe?
    Thanks a lot!
    Gerhard

  • What are the limitations in terms of data size  or performance while using csv or text file as datasource?

    <p>Also what are the limitations in terms of data size  or performance related issues while using csv or text file?</p><p>Is it the best practice to use csv , text file to use as a datasource to improve performance?</p><p>Please Advice.... </p><p>&#160;</p>

    <p>Hi,</p><p>Create Same Data Input for CSV and Text File ,Create 2 different reports one for CSV and One for Text ,run them one you have done that.</p><p>Go to Report Menu and Select Performance Information .Use the Data in that to check which one is good datasource to improve performance</p><p>Cheers</p><p>Rahul</p>

  • Why is Data Size in QT inspector twice the size of the file?

    I am not asking this to save space. I am just curious. When playing a dv (captured from camera) clip, I notice that the QT inspector shows data size about twice the size of the dv clip size in file system. Is it because the dv is compressed and QT decompresses?
    Actually, on clip in QT shows 22GB which is impossible to fit on a miniDV tape.

    You'll notice that a DV Stream file has two tracks (audio and video) of the same size when viewed in QuickTime Movie Inspector or the Movie Properties window of QuickTime Player Pro.
    Obviously the audio track shouldn't be the same size as the video track. There are separated from the single stream to allow editing.

  • Get Total DB size , Total DB free space , Total Data & Log File Sizes and Total Data & Log File free Sizes from a list of server

    how to get SQL server Total DB size , Total DB free space , Total Data  & Log File Sizes and Total Data  & Log File free Sizes from a list of server 

    Hi Shivanq,
    To get a list of databases, their sizes and the space available in each on the local SQL instance.
    dir SQLSERVER:\SQL\localhost\default\databases | Select Name, Size, SpaceAvailable | ft -auto
    This article is also helpful for you to get DB and Log File size information:
    Checking Database Space With PowerShell
    I hope this helps.

  • Can you record sound using a USB 6211 and convert the data to a .wav (or other sound) file?

    Hello,
    I am trying to build a system that will use a USB 6211 to record sounds from multiple electret microphones and then save the data as a .wav file or other sound file.  I have already built my mics and hooked the mics up to the USB 6211; the DAQ device seems to do an adequate job recording the signal - I've recorded from 3 mics at a time at 11,025 Hz, although I don't know how good the signals are since I can't save them for playback after the fact, and they aren't going through my sound card. Ultimately, I would like to save the data as a multichannel audio file which I could then open in a program such as Audacity for further editing and analysis. Since Audacity can import a variety of sound files, my file format doesn't need to be .wav if another format would work better.
    Any advice would be appreciated.
    Thanks, Eric

    If you are sampling all three simultaneously, your highest frequency recordable will be (11,025/2)/3, so about 1800Hz and that will pretty coarse (traditionally digital sound recording is at 44Ks/s at the low end). As to converting to a .wav, there are functions on the "Graphics and Sound" palette for saving waveforms to a .wav file.
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • File size in SWF header

    Hi All,
    Is there some way to avoid adding the uncompressed file
    length to the SWF header? (the 4 byte integer after the 3 byte
    signature and the 1 byte version number)
    Can I write some default value instead of the exact one?
    Any help would be highly appereciated,
    Yeeeev

    The file size field value is 5f030000, but the byte order is little endian and needs to be inverted. The inverted bytes are 00 00 03 5f (0x35f) (863).
    Here's a utility function to invert an unsigned int:
    function invertUint(value:uint):uint
        var result:uint=0;
        try{
             var ba:ByteArray=new ByteArray();
             ba.writeUnsignedInt(value);
             ba.position=0;
             ba.endian = Endian.LITTLE_ENDIAN;
             result = ba.readUnsignedInt();
        catch(err){}
        return result;

  • Install file(s) action - wrong file's modification date

    Hi,
    here is my problem:
    Files installed by bundle with "Install file(s)" action (or "Install Folder") have wrong "modification date" - actually set to: 17th january 1970.
    Zenworks 11.3, agent 11.3 or 11.2.4 mu1
    Anyone has this problem?
    Regards, ALipiec

    Just for info:
    I am on 11.3 and installed the file upload extension ZENworksFileUploadPlugin.msi with my user.
    I tested the "Install File(s)" function with Firefox 17 ESR:
    I only see the problem with date 12 January 1970 if I upload the file with I select "Do not compress or encrypt uploaded content".
    If I leave that switch unchecked the Creation, Modification, Access -Date are all the same and seem to be the time of the upload into the Repository.
    Even if I upload the file several times into repository it seems that the very first upload date/time is always kept for all following installations.
    Klaus

  • Incorrect file date and size

    I have just resaved a large project in Photoshop CS6 as both a .psd and .jpg file but both the file date and size in Explorer and Photoshop>Open show the date and size of a previous save.  This was a bit confusing and concerning as I thought I had lost all my hard work, but on opening both files they contain the latest updates.
    Anyone else experienced this, and why is it happening.
    Thanks

    They show the same date because what your looking Window at The File Explorer UI and Photoshop Is using a Windows File Open Dialog are showing the same File date. I ask where you were seeing dates in Photoshop.  It turns out your looking at file open which is using a windows dialog.   Windows file system records date for files in it file system directories and knows where application store dates in some files formats. Like Image files metadata.  Windows UI has options to display many of these dates.  Some date may be redundant however if there is an option to show a date it will be stored in a different location.  Which also means these redundant date may be out of sync if they are updated at different times.  Which date windows shows by default I'm not exactly sure which one that it is or when it gets updated.
    If you right click in the dialog column title bar you can select many dates to be displayed some date will not be present in many file formats. Here is a screen capture of Photoshop open dialog have you even seen this.

  • Wrong file in the "Populating an ArrayCollection with retrieved data" exercise

    In the "Populating  an ArrayCollection with retrieved data" there is a file ex2_04_starter.zip, which contains ex2_04_solution.mxml file and should contain ex2_04_start.mxml, right ?
    Great videos! Thank you!

    Hi Burpix,
    Looks like the link for the starter file within the exercise is linked to the wrong file.  If you pull the project archive for Day 2 you will get all of the starter & solution files and video transcripts for all of Day 2 exercises.  The starter file for ex2.04 is correct if download it from the project archive zip.  Adobe will be fixing the link within the exercise later but for now you can pull the correct starter file from the project archive zip.

  • Iphoto6: several issues: 1st my library is so messed up, everytime I delete a photo, in the next moment I look at a file the deleted photo has quadrupled, as with files, dates wrong

    iphoto6: several issues: 1st my library is so messed up, everytime I delete a photo, in the next moment I look at a file & the deleted photo has quadrupled, as with files, dates are all wrong, missing a few years.............

    Sounds like your database is damaged.
    Try these in order - from best option on down...
    1. Do you have an up-to-date back up? If so, try copy the library6.iphoto file from the back up to the iPhoto Library allowing it to overwrite the damaged file.
    2. Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one.  
    3. If neither of these work then you'll need to create and populate a new library.
    To create and populate a new *iPhoto 6* library:
    Note this will give you a working library with the same Rolls and pictures as before, however, you will lose your albums, keywords, modified versions, books, calendars etc.
    Move the iPhoto Library to the desktop
    Launch iPhoto. It will ask if you wish to create a new Library. Say Yes.
    Go into the iPhoto Library on your desktop and find the Originals folder. From the Originals folder drag the individual Roll Folders to the iPhoto Window and it will recreate them in the new library.
    When you're sure all is well you can delete the iPhoto Library on your desktop.
    In the future, in addition to your usual back up routine, you might like to make a copy of the library6.iPhoto file whenever you have made changes to the library as protection against database corruption.
    Regards
    TD

  • NullPointerException while uploading wrong file in af:inputfile

    Hi All,
    I am uploading excel sheet data into jspx Page(database table) by using af:inputFile.After uploading file af:inputFile need to be refresh.It is getting refresh for right file(excel file),but it is not refreshing for wrong file upload.
    it showing following error.
    UIComponent is null
    ADF_FACES-60097:For more information, please see the server's error log for an entry beginning with: ADF_FACES-60096:Server Exception during PPR, #2
    i had refer frank's blog https://blogs.oracle.com/jdevotnharvest/entry/how_to_reset_adf_faces.
    Could any one help on this!!
    Thanks in advance!!

    here is my jspx source code.
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:f="http://java.sun.com/jsf/core"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich" xmlns:h="http://java.sun.com/jsf/html">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document title="ExcelToTable.jspx" id="d1">
    <af:messages id="m1"/>
    <af:form id="f1" usesUpload="true">
    <af:pageTemplate viewId="/oracle/templates/threeColumnTemplate.jspx" id="pt1">
    <f:facet name="center">
    <af:panelSplitter id="ps1" orientation="vertical" splitterPosition="146">
    <f:facet name="first">
    <af:panelFormLayout id="pfl2">
    <af:panelLabelAndMessage label="#{bindings.Deptno.hints.label}" id="plam1">
    <af:outputText value="#{bindings.Deptno.inputValue}" id="ot1">
    <af:convertNumber groupingUsed="false" pattern="#{bindings.Deptno.format}"/>
    </af:outputText>
    </af:panelLabelAndMessage>
    <af:panelLabelAndMessage label="#{bindings.Dname.hints.label}" id="plam2">
    <af:outputText value="#{bindings.Dname.inputValue}" id="ot2"/>
    </af:panelLabelAndMessage>
    <af:panelLabelAndMessage label="#{bindings.Loc.hints.label}" id="plam3">
    <af:outputText value="#{bindings.Loc.inputValue}" id="ot3"/>
    </af:panelLabelAndMessage>
    <f:facet name="footer">
    <af:panelGroupLayout layout="vertical" id="pgl2">
    <af:panelGroupLayout layout="horizontal" id="pgl3">
    <f:facet name="separator">
    <af:spacer width="10" height="1" id="s1"/>
    </f:facet>
    <af:commandButton actionListener="#{bindings.First.execute}"
    text="First" disabled="#{!bindings.First.enabled}"
    partialSubmit="true" id="cb1"/>
    <af:commandButton actionListener="#{bindings.Previous.execute}"
    text="Previous"
    disabled="#{!bindings.Previous.enabled}"
    partialSubmit="true" id="cb4"/>
    <af:commandButton actionListener="#{bindings.Next.execute}" text="Next"
    disabled="#{!bindings.Next.enabled}"
    partialSubmit="true" id="cb5"/>
    <af:commandButton actionListener="#{bindings.Last.execute}" text="Last"
    disabled="#{!bindings.Last.enabled}"
    partialSubmit="true" id="cb6"/>
    </af:panelGroupLayout>
    <af:commandButton text="Submit" id="cb7"/>
    </af:panelGroupLayout>
    </f:facet>
    </af:panelFormLayout>
    </f:facet>
    <f:facet name="second">
    <af:panelCollection id="pc1">
    <f:facet name="menus"/>
    <f:facet name="toolbar">
    <af:toolbar id="t2">
    <af:commandButton actionListener="#{bindings.CreateInsert.execute}"
    text="InsertRow"
    disabled="#{!bindings.CreateInsert.enabled}" id="cb2"
    immediate="true"/>
    <af:commandButton actionListener="#{bindings.Delete.execute}"
    text="DeleteRow"
    disabled="#{!bindings.Delete.enabled}" id="cb3"
    immediate="true"/>
    </af:toolbar>
    </f:facet>
    <f:facet name="statusbar"/>
    <af:table value="#{bindings.EmpView3.collectionModel}" var="row"
    rows="#{bindings.EmpView3.rangeSize}"
    emptyText="#{bindings.EmpView3.viewable ? 'No data to display.' : 'Access Denied.'}"
    fetchSize="#{bindings.EmpView3.rangeSize}" rowBandingInterval="0"
    filterModel="#{bindings.EmpView3Query.queryDescriptor}"
    queryListener="#{bindings.EmpView3Query.processQuery}"
    filterVisible="true" varStatus="vs"
    selectedRowKeys="#{bindings.EmpView3.collectionModel.selectedRow}"
    selectionListener="#{bindings.EmpView3.collectionModel.makeCurrent}"
    rowSelection="single" id="t1" partialTriggers="::cb2 ::cb3">
    <af:column sortProperty="#{bindings.EmpView3.hints.Empno.name}"
    filterable="true" sortable="true"
    headerText="#{bindings.EmpView3.hints.Empno.label}" id="c1">
    <af:inputText value="#{row.bindings.Empno.inputValue}"
    label="#{bindings.EmpView3.hints.Empno.label}"
    required="#{bindings.EmpView3.hints.Empno.mandatory}"
    columns="#{bindings.EmpView3.hints.Empno.displayWidth}"
    maximumLength="#{bindings.EmpView3.hints.Empno.precision}"
    shortDesc="#{bindings.EmpView3.hints.Empno.tooltip}" id="it1">
    <f:validator binding="#{row.bindings.Empno.validator}"/>
    <af:convertNumber groupingUsed="false"
    pattern="#{bindings.EmpView3.hints.Empno.format}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="#{bindings.EmpView3.hints.Ename.name}"
    filterable="true" sortable="true"
    headerText="#{bindings.EmpView3.hints.Ename.label}" id="c2">
    <af:inputText value="#{row.bindings.Ename.inputValue}"
    label="#{bindings.EmpView3.hints.Ename.label}"
    required="#{bindings.EmpView3.hints.Ename.mandatory}"
    columns="#{bindings.EmpView3.hints.Ename.displayWidth}"
    maximumLength="#{bindings.EmpView3.hints.Ename.precision}"
    shortDesc="#{bindings.EmpView3.hints.Ename.tooltip}" id="it2">
    <f:validator binding="#{row.bindings.Ename.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="#{bindings.EmpView3.hints.Job.name}" filterable="true"
    sortable="true" headerText="#{bindings.EmpView3.hints.Job.label}"
    id="c3">
    <af:inputText value="#{row.bindings.Job.inputValue}"
    label="#{bindings.EmpView3.hints.Job.label}"
    required="#{bindings.EmpView3.hints.Job.mandatory}"
    columns="#{bindings.EmpView3.hints.Job.displayWidth}"
    maximumLength="#{bindings.EmpView3.hints.Job.precision}"
    shortDesc="#{bindings.EmpView3.hints.Job.tooltip}" id="it3">
    <f:validator binding="#{row.bindings.Job.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="#{bindings.EmpView3.hints.Mgr.name}" filterable="true"
    sortable="true" headerText="#{bindings.EmpView3.hints.Mgr.label}"
    id="c4">
    <af:inputText value="#{row.bindings.Mgr.inputValue}"
    label="#{bindings.EmpView3.hints.Mgr.label}"
    required="#{bindings.EmpView3.hints.Mgr.mandatory}"
    columns="#{bindings.EmpView3.hints.Mgr.displayWidth}"
    maximumLength="#{bindings.EmpView3.hints.Mgr.precision}"
    shortDesc="#{bindings.EmpView3.hints.Mgr.tooltip}" id="it4">
    <f:validator binding="#{row.bindings.Mgr.validator}"/>
    <af:convertNumber groupingUsed="false"
    pattern="#{bindings.EmpView3.hints.Mgr.format}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="#{bindings.EmpView3.hints.Hiredate.name}"
    filterable="true" sortable="true"
    headerText="#{bindings.EmpView3.hints.Hiredate.label}" id="c5">
    <f:facet name="filter">
    <af:inputDate value="#{vs.filterCriteria.Hiredate}" id="id1">
    <af:convertDateTime pattern="#{bindings.EmpView3.hints.Hiredate.format}"/>
    </af:inputDate>
    </f:facet>
    <af:inputDate value="#{row.bindings.Hiredate.inputValue}"
    label="#{bindings.EmpView3.hints.Hiredate.label}"
    required="#{bindings.EmpView3.hints.Hiredate.mandatory}"
    columns="#{bindings.EmpView3.hints.Hiredate.displayWidth}"
    shortDesc="#{bindings.EmpView3.hints.Hiredate.tooltip}"
    id="id2">
    <f:validator binding="#{row.bindings.Hiredate.validator}"/>
    <af:convertDateTime pattern="#{bindings.EmpView3.hints.Hiredate.format}"/>
    </af:inputDate>
    </af:column>
    <af:column sortProperty="#{bindings.EmpView3.hints.Sal.name}" filterable="true"
    sortable="true" headerText="#{bindings.EmpView3.hints.Sal.label}"
    id="c6">
    <af:inputText value="#{row.bindings.Sal.inputValue}"
    label="#{bindings.EmpView3.hints.Sal.label}"
    required="#{bindings.EmpView3.hints.Sal.mandatory}"
    columns="#{bindings.EmpView3.hints.Sal.displayWidth}"
    maximumLength="#{bindings.EmpView3.hints.Sal.precision}"
    shortDesc="#{bindings.EmpView3.hints.Sal.tooltip}" id="it5">
    <f:validator binding="#{row.bindings.Sal.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="#{bindings.EmpView3.hints.Comm.name}" filterable="true"
    sortable="true" headerText="#{bindings.EmpView3.hints.Comm.label}"
    id="c7">
    <af:inputText value="#{row.bindings.Comm.inputValue}"
    label="#{bindings.EmpView3.hints.Comm.label}"
    required="#{bindings.EmpView3.hints.Comm.mandatory}"
    columns="#{bindings.EmpView3.hints.Comm.displayWidth}"
    maximumLength="#{bindings.EmpView3.hints.Comm.precision}"
    shortDesc="#{bindings.EmpView3.hints.Comm.tooltip}" id="it6">
    <f:validator binding="#{row.bindings.Comm.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="#{bindings.EmpView3.hints.Deptno.name}"
    filterable="true" sortable="true"
    headerText="#{bindings.EmpView3.hints.Deptno.label}" id="c8">
    <af:inputText value="#{row.bindings.Deptno.inputValue}"
    label="#{bindings.EmpView3.hints.Deptno.label}"
    required="#{bindings.EmpView3.hints.Deptno.mandatory}"
    columns="#{bindings.EmpView3.hints.Deptno.displayWidth}"
    maximumLength="#{bindings.EmpView3.hints.Deptno.precision}"
    shortDesc="#{bindings.EmpView3.hints.Deptno.tooltip}"
    id="it7">
    <f:validator binding="#{row.bindings.Deptno.validator}"/>
    <af:convertNumber groupingUsed="false"
    pattern="#{bindings.EmpView3.hints.Deptno.format}"/>
    </af:inputText>
    </af:column>
    </af:table>
    </af:panelCollection>
    </f:facet>
    </af:panelSplitter>
    </f:facet>
    <f:facet name="header"/>
    <f:facet name="start">
    <af:panelGroupLayout id="pgl1">
    <af:panelFormLayout id="pfl1">
    <f:facet name="footer">
    <af:commandButton text="Upload" id="uploadButton"
    actionListener="#{FileProcessor.checkFile}" partialSubmit="true"/>
    </f:facet>
    <af:inputFile label="EmpFile" id="if1" value="#{FileProcessor.uploadedFile}"
    partialTriggers="uploadButton" binding="#{FileProcessor.inputFile}"/>
    <af:messages id="m2"/>
    </af:panelFormLayout>
    </af:panelGroupLayout>
    </f:facet>
    <f:facet name="branding"/>
    <f:facet name="copyright"/>
    <f:facet name="status"/>
    </af:pageTemplate>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>
    and bean class code is as follows.
    package xxorn.model.view;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import javax.faces.application.FacesMessage;
    import javax.faces.component.UIComponent;
    import javax.faces.component.UIViewRoot;
    import javax.faces.context.FacesContext;
    import javax.faces.event.ActionEvent;
    import oracle.adf.view.rich.component.rich.input.RichInputFile;
    import oracle.adf.view.rich.component.rich.output.RichMessages;
    import oracle.adf.view.rich.context.AdfFacesContext;
    import org.apache.myfaces.trinidad.model.UploadedFile;
    import org.apache.myfaces.trinidad.util.ComponentUtils;
    public class FileProcessor {
    private CSVtoADFTableProcessor tablecreator;
    private UploadedFile uploadedFile;
    private String filename;
    private long filesize;
    private String filecontents;
    private String filetype;
    private RichMessages errorMsg;
    private RichInputFile inputFile;
    public FileProcessor() {
    public void setUploadedFile(UploadedFile uploadedFile) {
    this.uploadedFile = uploadedFile;
    this.filename = uploadedFile.getFilename();
    this.filesize = uploadedFile.getLength();
    this.filetype = uploadedFile.getContentType();
    try {
    if (filename.endsWith(".csv"))
    tablecreator.processCSV(uploadedFile.getInputStream());
    else if(filename.endsWith(".xls")){
    System.out.println("uploaded file is ********"+uploadedFile);
    tablecreator.fileSubmit(uploadedFile.getInputStream());
    //tablecreator.WriteXLS(uploadedFile.getInputStream());
    else if (filename.endsWith(".xlsx")){
    tablecreator.fileSubmitXSSF(uploadedFile.getInputStream());
    //wrong file upload
    else{
    String msg="this is a global message.";
    FacesContext ctx =FacesContext.getCurrentInstance();
    FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, "Please Upload proper file");
    ctx.addMessage(null,fm);
    } catch (IOException e) {
    e.printStackTrace();
    public void convertStreamToString(InputStream is) throws IOException {
    StringBuilder sb = new StringBuilder();
    String line;
    BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
    while ((line = reader.readLine()) != null) {
    sb.append(line).append("\n");
    System.out.println(sb.toString());
    public UploadedFile getUploadedFile() {
    return uploadedFile;
    public void setFilename(String filename) {
    this.filename = filename;
    public String getFilename() {
    return filename;
    public void setFilesize(long filesize) {
    this.filesize = filesize;
    public long getFilesize() {
    return filesize;
    public void setFilecontents(String filecontents) {
    this.filecontents = filecontents;
    public String getFilecontents() {
    return filecontents;
    public void setFiletype(String filetype) {
    this.filetype = filetype;
    public String getFiletype() {
    return filetype;
    public void setTablecreator(CSVtoADFTableProcessor tablecreator) {
    this.tablecreator = tablecreator;
    public CSVtoADFTableProcessor getTablecreator() {
    return tablecreator;
    public void setErrorMsg(RichMessages errorMsg) {
    this.errorMsg = errorMsg;
    public RichMessages getErrorMsg() {
    return errorMsg;
    public String checkFile(ActionEvent actionEvent) throws Exception {
    // Add event code here...
    System.out.println("in upload action event");
    /* RichInputFile vTheInputFileComponent = getInputFile();
    vTheInputFileComponent.resetValue();*/
    FacesContext vFacesContext = FacesContext.getCurrentInstance();
    UIViewRoot vUIViewRoot = vFacesContext.getViewRoot();
    RichInputFile vTheInputFileComponent =
    (RichInputFile)vUIViewRoot.findComponent("if1");
    vTheInputFileComponent.resetValue();
    AdfFacesContext adfFacesCtx = AdfFacesContext.getCurrentInstance();
    adfFacesCtx.addPartialTarget(inputFile);
    return null;
    public void setInputFile(RichInputFile inputFile) {
    this.inputFile = inputFile;
    inputFile=null;
    public RichInputFile getInputFile() {
    return inputFile;
    }

  • IPhone photo/video library glitch - wrong file extensions, name shift, lost files etc [LONG story - sorry]

    I have a 5s running 7.0.4. and my computer is running Windows 8.1.
    We had a baby and my phone filled up fast with pictures and videos, so I decided to offload them onto my PC. I connected my phone to the usb port, and directly copied from the DCIM folder to my hard drive.
    Something happened during the first attempt, and the process was interrupted. So I went into each of the sub folders, and selected all files, and started the copy process again. I told the computer to skip any existing files.
    So all the file counts matched in each folder, and I figured it was safe to start deleting from my iPhone.
    On my hard drive, I separated all the MOV files into my Videos folder. But in Windows Explorer, the thumbnail view showed several MOV files with no thumbnail - just the generic icon.
    As I sorted my photos into various folders, I also noticed a lot of generic icons instead of thumbnails for the JPGs. I started to feel concerned that my files had become corrupt during the transfer. But then I noticed a PNG file that was a few hundred megabytes. This was odd, so I added the MOV extension to it. Sure enough, it was a video with the wrong extension.
    I renamed every PNG and JPG file that had no thumbnail to add the MOV extension. Every one was a video with the wrong file extension.
    Then I went to the video folder, and all the MOV files that had the generic icon were actually JPG files.
    Well I was just happy to see that the files were not corrupt.
    One more time before I deleted things from my iPhone, I did a spot check to see that the largest videos were on my hard drive. I found a few videos that were not copied over, despite the file counts having been accurate. So I copied the videos again, and compared file sizes and date/times when there was an overwrite prompt. Most were matches, but several were the same file name with different sizes and dates.
    I didn't know what was going on, but I just wanted to get the files on my computer. So I renamed my local copy where there was a name collision, and copied the videos. I deleted the videos from my phone as I went along.
    I felt pretty confident that I had all the files copied now, so I began mass deleting my photos.
    I went to the Photos app on the phone, and watched the thousands of pictures disappear, and the glorious free space grow on my phone.
    But wait... there was still 1 video in the Photos app. I thought I had gotten all the MOV files off the phone...
    I have a photo info app installed, so I was able to see the file name of the video. I searched for that file name in the DCIM subfolders, but the folder that had that series of files (the IMG_3000-3999 files) listed the files with that particular video skipped. It was clearly still on my phone, because I could play it.
    Then I noticed it was a 45 minute long video of my baby. About 5 GB. So I figured it must be due to the file size that it wasn't visible from explorer. (Can't explain why that would be, but M$ keeps changing crap too. I never freaking know what to expect from them either.)
    After having deleted all the jpg, png and mov files from the DCIM folder, there were still about 26 files in my camera roll on the iPhone. And I could still view the video.
    I decided I wasn't concerned about the photos, I just wanted to figure out how to get the video onto my computer.
    So I selected all the photos in the photo app (skipping the 1 remaining video) and tapped the trash can.
    Poof! One item remained, and it was one of the garbage photos. My video is GONE! ^#@*&#($^@Q&%( And no, I didn't fat-finger it. I was very careful to select the correct thumbnails.
    Looking back, I know that I should have just started the entire file copy process from scratch when funny stuff started happening like mismatched file names. But I am a sleep-deprived new mom and just wasn't thinking clearly. It would be nice if I could have used my file/directory compare program to check the iPhone against my laptop, but it is not compatible with devices, only removable drives.
    And no, I don't use iTunes. I stopped using iTunes years ago when it would randomly decide to delete contacts from my phone just because they didn't exist on my computer or some sh-- like that. I have always just manually synced all my stuff and have never had an issue like this. To say I am sad to lose that video is an understatement.
    I googled "iPhone undelete" and "iPhone data recovery" and downloaded a trial for one of the likely candidates. It turned up a bunch of garbage, but not my video.
    Anyways... I am wondering if anyone else has experienced this type of scenario? Has anybody identified what could cause this to happen? I would like to avoid this in the future. (I will avoid this type of loss, because I know now what I could have done differently to be more careful. But it would be nice if I didn't have to get all neurotic about checking 60GB of photos/videos side by side each time I copy them to my computer...)
    I have seen other threads on the forum here regarding corrupted libraries and such, but I am not sure this is the same thing.
    One suspicion I have is that it might have to do with the iPhoto app being installed on the phone. I can't articulate why I think that is worth considering. But when I looked at my Video folder, I ended up with many duplicate videos, and all the duplicated videos' file names were 2 numbers apart. As if all the file names got shifted at some point. Very strange.
    Thanks for listening to my rant. If anybody has an idea, I am interested. If anybody else has lost precious memories due to this, we should talk. If it is a widespread problem, maybe we can all get together and pound down Apple's door?
    As an aside: Why am I unable to select Apple Support Community to post this question to?

    In my case number of weird things happen whenever I try to copy pictures/videos from my iPhone from direct USB...
    1. JPG files are wrongly named as MOV and vice versa.
    2. I copy only folders but in addition files with no extension are copied in the main folder, very strange.
    3. Whenever I open one of the folders, strange icons like this () start appearing which cannot be copied even.
    Unfortunately I used to delete a lot of files with wrong extensions in the past because I never new they could be fixed.
    Apple should answer this!
    Note: I am using Windows 8.1 and use a direct USB cable without iTunes to copy the media files directly from My Computer.

Maybe you are looking for