This method extracts view data from the MPP file.

@throws IOException
161205
private void processViewData() throws IOException
   {
      DirectoryEntry dir = (DirectoryEntry) m_viewDir.getEntry("CV_iew");
      VarMeta viewVarMeta = new VarMeta9(new DocumentInputStream(((DocumentEntry) dir.getEntry("VarMeta"))));
      Var2Data viewVarData = new Var2Data(viewVarMeta, new DocumentInputStream(((DocumentEntry) dir.getEntry("Var2Data"))));
      FixedMeta fixedMeta = new FixedMeta(new DocumentInputStream(((DocumentEntry) dir.getEntry("FixedMeta"))), 10);
      FixedData fixedData = new FixedData(122, m_inputStreamFactory.getInstance(dir, "FixedData"));

      int items = fixedMeta.getAdjustedItemCount();
      View view;
      ViewFactory factory = new ViewFactory9();

      int lastOffset = -1;
      for (int loop = 0; loop < items; loop++)
      {
         byte[] fm = fixedMeta.getByteArrayValue(loop);
         int offset = MPPUtility.getShort(fm, 4);
         if (offset > lastOffset)
         {
            byte[] fd = fixedData.getByteArrayValue(fixedData.getIndexFromOffset(offset));
            if (fd != null)
            {
               view = factory.createView(m_file, fm, fd, viewVarData, m_fontBases);
               m_file.getViews().add(view);
               //System.out.print(view);
            }
            lastOffset = offset;
         }
      }
   }
742959
private void writeFileCreationRecord() throws IOException
   {
      ProjectProperties properties = m_projectFile.getProjectProperties();

      m_buffer.setLength(0);
      m_buffer.append("MPX");
      m_buffer.append(m_delimiter);
      m_buffer.append(properties.getMpxProgramName());
      m_buffer.append(m_delimiter);
      m_buffer.append(properties.getMpxFileVersion());
      m_buffer.append(m_delimiter);
      m_buffer.append(properties.getMpxCodePage());
      m_buffer.append(MPXConstants.EOL);
      m_writer.write(m_buffer.toString());
   }
1336655
private ProjectFile readProjectFile(ProjectReader reader, File file) throws MPXJException
   {
      addListeners(reader);
      return reader.read(file);
   }
609929
@Override public void process(MPPReader reader, ProjectFile file, DirectoryEntry root) throws MPXJException, IOException
   {
      try
      {
         populateMemberData(reader, file, root);
         processProjectProperties();

         if (!reader.getReadPropertiesOnly())
         {
            processSubProjectData();
            processGraphicalIndicators();
            processCustomValueLists();
            processCalendarData();
            processResourceData();
            processTaskData();
            processConstraintData();
            processAssignmentData();
            postProcessTasks();

            if (reader.getReadPresentationData())
            {
               processViewPropertyData();
               processTableData();
               processViewData();
               processFilterData();
               processGroupData();
               processSavedViewState();
            }
         }
      }

      finally
      {
         clearMemberData();
      }
   }
182246
private String processViewPropertySvgReference(final String viewProperty) throws IOException {
        // find start of value
        int indexOfColon = viewProperty.indexOf(':');
        if (indexOfColon > -1) {
            int indexOfValueStart = -1;
            int indexOfSQ = viewProperty.indexOf('\'',
                                                 indexOfColon + 1);
            int indexOfDQ = viewProperty.indexOf('"',
                                                 indexOfColon + 1);
            if (indexOfSQ > -1) {
                indexOfValueStart = indexOfSQ;
            } else {
                indexOfValueStart = indexOfDQ;
            }
            if (indexOfValueStart > -1) {
                String viewValue = viewProperty.substring(indexOfValueStart + 1);

                // find end of value
                int indexOfValueEnd = -1;
                indexOfSQ = viewValue.lastIndexOf('\'');
                indexOfDQ = viewValue.lastIndexOf('"');
                if (indexOfSQ > -1) {
                    indexOfValueEnd = indexOfSQ;
                } else {
                    indexOfValueEnd = indexOfDQ;
                }
                if (indexOfValueEnd > -1) {
                    viewValue = viewValue.substring(0,
                                                    indexOfValueEnd);
                    if (viewValue.endsWith(SVG_FILE_SUFFIX)) {
                        // read svg file
                        String svgContents = getReferencedSvgFileContents(viewValue);
                        if (svgContents != null) {
                            String ignorableViewProperty = viewProperty.replace("\"view\"",
                                                                                "\"_view_file\"");
                            StringBuilder newViewProperty = new StringBuilder(ignorableViewProperty).append(LINE_SEPARATOR);
                            newViewProperty.append(viewProperty.substring(0,
                                                                          indexOfValueStart));
                            newViewProperty.append("\"").append(svgContents).append("\",").append(LINE_SEPARATOR);
                            return newViewProperty.toString();
                        }
                    }
                }
            }
        }

        // property not changed, return original property
        return viewProperty + LINE_SEPARATOR;
    }
631146
private String getPemFileData() throws IOException {
        final String methodName = "getPemFileData";
        logger.entry(this, methodName);
        
        if (pemFileData != null) {
            logger.exit(this, methodName, pemFileData);
            return pemFileData;
        }
        
        final StringBuilder sb = new StringBuilder();
        final InputStreamReader isr = new InputStreamReader(new FileInputStream(pemFile), "US-ASCII");
        try {
            int ch;
            while ((ch = isr.read()) != -1) {
                sb.append((char)ch);
            }
        } finally {
            try {
                isr.close();
            } catch (IOException e) {
                logger.data(this, methodName, "Failed to close input stream reader. Reason: ", e);
            }
        }
        
        pemFileData = sb.toString();

        logger.exit(this, methodName, pemFileData);

        return pemFileData;
    }
11805
public OutputStream extractData(
                    final ClientHttpResponse response
                    )
    throws IOException
    {
        IoUtil.copy( response.getBody(), _output );

        return _output;
    }
310215
public void extract(@NotNull final RandomAccessReader reader, @NotNull final Metadata metadata, int readerOffset, @Nullable Directory parentDirectory)
    {
        ExifTiffHandler exifTiffHandler = new ExifTiffHandler(metadata, parentDirectory);

        try {
            // Read the TIFF-formatted Exif data
            new TiffReader().processTiff(
                reader,
                exifTiffHandler,
                readerOffset
            );
        } catch (TiffProcessingException e) {
            exifTiffHandler.error("Exception processing TIFF data: " + e.getMessage());
            // TODO what do to with this error state?
            e.printStackTrace(System.err);
        } catch (IOException e) {
            exifTiffHandler.error("Exception processing TIFF data: " + e.getMessage());
            // TODO what do to with this error state?
            e.printStackTrace(System.err);
        }
    }
958956
private void addViews(MpxjTreeNode parentNode, ProjectFile file)
   {
      for (View view : file.getViews())
      {
         final View v = view;
         MpxjTreeNode childNode = new MpxjTreeNode(view)
         {
            @Override public String toString()
            {
               return v.getName();
            }
         };
         parentNode.add(childNode);
      }
   }
932118
@Override
	public void write(DataOutputView out) throws IOException {
		out.writeInt(length);
		out.writeInt(position);

		out.write(data, 0, position);
	}
1245855
protected void loadDataFromFile(InputStream is) throws IOException {
		PHPFileParser fp = new PHPFileParser(is);
		createInternalDataStructre(fp.getSections());
	}
780309
private void processProjectProperties() throws MPXJException
   {
      ProjectPropertiesReader reader = new ProjectPropertiesReader();
      reader.process(m_file, m_projectProps, m_root);
   }
934256
private void populateMemberData(MPPReader reader, ProjectFile file, DirectoryEntry root) throws FileNotFoundException, IOException, MPXJException
   {
      m_reader = reader;
      m_file = file;
      m_eventManager = file.getEventManager();
      m_root = root;

      //
      // Retrieve the high level document properties
      //
      Props14 props14 = new Props14(new DocumentInputStream(((DocumentEntry) root.getEntry("Props14"))));
      //System.out.println(props14);

      file.getProjectProperties().setProjectFilePath(props14.getUnicodeString(Props.PROJECT_FILE_PATH));
      m_inputStreamFactory = new DocumentInputStreamFactory(props14);

      //
      // Test for password protection. In the single byte retrieved here:
      //
      // 0x00 = no password
      // 0x01 = protection password has been supplied
      // 0x02 = write reservation password has been supplied
      // 0x03 = both passwords have been supplied
      //
      if ((props14.getByte(Props.PASSWORD_FLAG) & 0x01) != 0)
      {
         // Couldn't figure out how to get the password for MPP14 files so for now we just need to block the reading
         throw new MPXJException(MPXJException.PASSWORD_PROTECTED);
      }

      m_resourceMap = new HashMap<Integer, ProjectCalendar>();
      m_projectDir = (DirectoryEntry) root.getEntry("   114");
      m_viewDir = (DirectoryEntry) root.getEntry("   214");
      DirectoryEntry outlineCodeDir = (DirectoryEntry) m_projectDir.getEntry("TBkndOutlCode");
      m_outlineCodeVarMeta = new VarMeta12(new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("VarMeta"))));
      m_outlineCodeVarData = new Var2Data(m_outlineCodeVarMeta, new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("Var2Data"))));
      m_outlineCodeFixedMeta = new FixedMeta(new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("FixedMeta"))), 10);
      m_outlineCodeFixedData = new FixedData(m_outlineCodeFixedMeta, new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("FixedData"))));
      m_outlineCodeFixedMeta2 = new FixedMeta(new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("Fixed2Meta"))), 10);
      m_outlineCodeFixedData2 = new FixedData(m_outlineCodeFixedMeta2, new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("Fixed2Data"))));
      m_projectProps = new Props14(m_inputStreamFactory.getInstance(m_projectDir, "Props"));
      //MPPUtility.fileDump("c:\\temp\\props.txt", m_projectProps.toString().getBytes());
      //FieldMap fm = new FieldMap14(m_file);
      //fm.dumpKnownFieldMaps(m_projectProps);

      m_fontBases = new HashMap<Integer, FontBase>();
      m_taskSubProjects = new HashMap<Integer, SubProject>();
      m_parentTasks = new HashMap<Integer, Integer>();
      m_taskOrder = new TreeMap<Long, Integer>();
      m_nullTaskOrder = new TreeMap<Integer, Integer>();

      m_file.getProjectProperties().setMppFileType(Integer.valueOf(14));
      m_file.getProjectProperties().setAutoFilter(props14.getBoolean(Props.AUTO_FILTER));
   }
1074787
public void processData() {

        // get number of hands
        float handNum = readbackBuffer.get(0);
        int count = 1;

        boolean rightHandProcessed = false;
        boolean leftHandProcessed = false;

        for (int handCount = 0; handCount < handNum; handCount++) {
            IOHand ioHand;
            HandIODevice device;
            if (handCount == 0) {
                ioHand = rightHand;
                device = rightDevice;
                rightHandProcessed = true;
                GVRSceneObject right = rightHand.getSceneObject();
                if (!right.isEnabled()) {
                    rightHand.getSceneObject().setEnable(true);
                    device.setVisible(true);
                }
            } else {
                ioHand = leftHand;
                device = leftDevice;
                leftHandProcessed = true;
                GVRSceneObject left = leftHand.getSceneObject();
                if (!left.isEnabled()) {
                    leftHand.getSceneObject().setEnable(true);
                    device.setVisible(true);
                }
            }

            //Process Thumbs
            IOFinger ioFinger = ioHand.getIOFinger(IOFinger.THUMB);
            for (int boneNum = 0; boneNum < 4; boneNum++) {
                IOJoint ioJoint = ioFinger.getIOJoint(boneNum + 1);
                if (ioJoint != null) {
                    ioJoint.setPosition(readbackBuffer.get(count), readbackBuffer.get
                            (count + 1), readbackBuffer.get(count + 2));
                }
                count = count + 3;
            }

            setBones(ioFinger);

            if (handCount == 0) {
                // right hand
                for (int fingerNum = 1; fingerNum < 5; fingerNum++) {
                    ioFinger = ioHand.getIOFinger(fingerNum);
                    for (int boneNum = 0; boneNum < 4; boneNum++) {
                        IOJoint ioJoint = ioFinger.getIOJoint(boneNum + 1);
                        if (ioJoint != null) {
                            ioJoint.setPosition(readbackBuffer.get(count), readbackBuffer.get
                                    (count + 1), readbackBuffer.get(count + 2));
                        }
                        count = count + 3;
                    }
                    setBones(ioFinger);
                }
            } else {
                // left hand
                for (int fingerNum = 4; fingerNum > 0; fingerNum--) {
                    ioFinger = ioHand.getIOFinger(fingerNum);
                    for (int boneNum = 0; boneNum < 4; boneNum++) {
                        IOJoint ioJoint = ioFinger.getIOJoint(boneNum + 1);
                        if (ioJoint != null) {
                            ioJoint.setPosition(readbackBuffer.get(count), readbackBuffer.get
                                    (count + 1), readbackBuffer.get(count + 2));
                        }
                        count = count + 3;
                    }
                    setBones(ioFinger);
                }
            }

            //get palm position
            ioHand.getPalmSceneObject().getTransform().setPosition(readbackBuffer.get(count),
                    readbackBuffer.get(count + 1), readbackBuffer.get(count + 2));
            count = count + 3;
            cursorRotation.identity();
            device.process(ioHand.getIOFinger(IOFinger.INDEX).getIOJoint(IOJoint.TIP).getPosition(),
                    cursorRotation);
        }

        if (!rightHandProcessed) {
            GVRSceneObject right = rightHand.getSceneObject();
            if (right.isEnabled()) {
                rightHand.getSceneObject().setEnable(false);
            }
            rightDevice.setVisible(false);
        }
        if (!leftHandProcessed) {
            GVRSceneObject left = leftHand.getSceneObject();
            if (left.isEnabled()) {
                leftHand.getSceneObject().setEnable(false);
            }
            leftDevice.setVisible(false);
        }
    }
1374143
private void processResourceData() throws IOException
   {
      FieldMap fieldMap = new FieldMap12(m_file.getProjectProperties(), m_file.getCustomFields());
      fieldMap.createResourceFieldMap(m_projectProps);

      FieldMap enterpriseCustomFieldMap = new FieldMap12(m_file.getProjectProperties(), m_file.getCustomFields());
      enterpriseCustomFieldMap.createEnterpriseCustomFieldMap(m_projectProps, ResourceField.class);

      DirectoryEntry rscDir = (DirectoryEntry) m_projectDir.getEntry("TBkndRsc");
      VarMeta rscVarMeta = new VarMeta12(new DocumentInputStream(((DocumentEntry) rscDir.getEntry("VarMeta"))));
      Var2Data rscVarData = new Var2Data(rscVarMeta, new DocumentInputStream(((DocumentEntry) rscDir.getEntry("Var2Data"))));
      FixedMeta rscFixedMeta = new FixedMeta(new DocumentInputStream(((DocumentEntry) rscDir.getEntry("FixedMeta"))), 37);
      FixedData rscFixedData = new FixedData(rscFixedMeta, m_inputStreamFactory.getInstance(rscDir, "FixedData"));
      FixedMeta rscFixed2Meta = new FixedMeta(new DocumentInputStream(((DocumentEntry) rscDir.getEntry("Fixed2Meta"))), 49);
      FixedData rscFixed2Data = new FixedData(rscFixed2Meta, m_inputStreamFactory.getInstance(rscDir, "Fixed2Data"));
      Props12 props = new Props12(m_inputStreamFactory.getInstance(rscDir, "Props"));
      //System.out.println(rscVarMeta);
      //System.out.println(rscVarData);
      //System.out.println(rscFixedMeta);
      //System.out.println(rscFixedData);
      //System.out.println(rscFixed2Meta);
      //System.out.println(rscFixed2Data);
      //System.out.println(props);

      // Process aliases
      new CustomFieldAliasReader(m_file.getCustomFields(), props.getByteArray(RESOURCE_FIELD_NAME_ALIASES)).process();

      TreeMap<Integer, Integer> resourceMap = createResourceMap(fieldMap, rscFixedMeta, rscFixedData);
      Integer[] uniqueid = rscVarMeta.getUniqueIdentifierArray();
      Integer id;
      Integer offset;
      byte[] data;
      byte[] metaData;
      Resource resource;

      String notes;

      for (int loop = 0; loop < uniqueid.length; loop++)
      {
         id = uniqueid[loop];
         offset = resourceMap.get(id);
         if (offset == null)
         {
            continue;
         }

         data = rscFixedData.getByteArrayValue(offset.intValue());
         byte[] metaData2 = rscFixed2Meta.getByteArrayValue(offset.intValue());
         byte[] data2 = rscFixed2Data.getByteArrayValue(offset.intValue());
         //metaData = rscFixedMeta.getByteArrayValue(offset.intValue());
         //MPPUtility.dataDump(data, true, true, true, true, true, true, true);
         //MPPUtility.dataDump(metaData, true, true, true, true, true, true, true);
         //MPPUtility.varDataDump(rscVarData, id, true, true, true, true, true, true);

         resource = m_file.addResource();

         resource.disableEvents();
         fieldMap.populateContainer(ResourceField.class, resource, id, new byte[][]
         {
            data,
            data2
         }, rscVarData);

         enterpriseCustomFieldMap.populateContainer(ResourceField.class, resource, id, null, rscVarData);

         resource.enableEvents();

         resource.setBudget((metaData2[8] & 0x20) != 0);

         resource.setGUID(MPPUtility.getGUID(data2, 0));

         processHyperlinkData(resource, rscVarData.getByteArray(id, fieldMap.getVarDataKey(ResourceField.HYPERLINK_DATA)));

         resource.setID(Integer.valueOf(MPPUtility.getInt(data, 4)));

         resource.setOutlineCode1(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE1_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode2(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE2_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode3(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE3_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode4(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE4_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode5(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE5_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode6(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE6_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode7(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE7_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode8(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE8_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode9(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE9_INDEX))), OUTLINECODE_DATA));
         resource.setOutlineCode10(m_outlineCodeVarData.getUnicodeString(Integer.valueOf(rscVarData.getInt(id, 2, fieldMap.getVarDataKey(ResourceField.OUTLINE_CODE10_INDEX))), OUTLINECODE_DATA));

         resource.setUniqueID(id);

         metaData = rscFixedMeta.getByteArrayValue(offset.intValue());
         resource.setFlag(1, (metaData[28] & 0x40) != 0);
         resource.setFlag(2, (metaData[28] & 0x80) != 0);
         resource.setFlag(3, (metaData[29] & 0x01) != 0);
         resource.setFlag(4, (metaData[29] & 0x02) != 0);
         resource.setFlag(5, (metaData[29] & 0x04) != 0);
         resource.setFlag(6, (metaData[29] & 0x08) != 0);
         resource.setFlag(7, (metaData[29] & 0x10) != 0);
         resource.setFlag(8, (metaData[29] & 0x20) != 0);
         resource.setFlag(9, (metaData[29] & 0x40) != 0);
         resource.setFlag(10, (metaData[28] & 0x20) != 0);
         resource.setFlag(11, (metaData[29] & 0x80) != 0);
         resource.setFlag(12, (metaData[30] & 0x01) != 0);
         resource.setFlag(13, (metaData[30] & 0x02) != 0);
         resource.setFlag(14, (metaData[30] & 0x04) != 0);
         resource.setFlag(15, (metaData[30] & 0x08) != 0);
         resource.setFlag(16, (metaData[30] & 0x10) != 0);
         resource.setFlag(17, (metaData[30] & 0x20) != 0);
         resource.setFlag(18, (metaData[30] & 0x40) != 0);
         resource.setFlag(19, (metaData[30] & 0x80) != 0);
         resource.setFlag(20, (metaData[31] & 0x01) != 0);

         notes = resource.getNotes();
         if (m_reader.getPreserveNoteFormatting() == false)
         {
            notes = RtfHelper.strip(notes);
         }
         resource.setNotes(notes);

         //
         // Configure the resource calendar
         //
         resource.setResourceCalendar(m_resourceMap.get(id));

         //
         // Process any enterprise columns
         //
         processResourceEnterpriseColumns(resource, metaData2);

         //
         // Process cost rate tables
         //
         CostRateTableFactory crt = new CostRateTableFactory();
         crt.process(resource, 0, rscVarData.getByteArray(id, fieldMap.getVarDataKey(ResourceField.COST_RATE_A)));
         crt.process(resource, 1, rscVarData.getByteArray(id, fieldMap.getVarDataKey(ResourceField.COST_RATE_B)));
         crt.process(resource, 2, rscVarData.getByteArray(id, fieldMap.getVarDataKey(ResourceField.COST_RATE_C)));
         crt.process(resource, 3, rscVarData.getByteArray(id, fieldMap.getVarDataKey(ResourceField.COST_RATE_D)));
         crt.process(resource, 4, rscVarData.getByteArray(id, fieldMap.getVarDataKey(ResourceField.COST_RATE_E)));

         //
         // Process availability table
         //
         AvailabilityFactory af = new AvailabilityFactory();
         af.process(resource.getAvailability(), rscVarData.getByteArray(id, fieldMap.getVarDataKey(ResourceField.AVAILABILITY_DATA)));

         //
         // Process resource type
         //
         if ((metaData[9] & 0x02) != 0)
         {
            resource.setType(ResourceType.WORK);
         }
         else
         {
            if ((metaData2[8] & 0x10) != 0)
            {
               resource.setType(ResourceType.COST);
            }
            else
            {
               resource.setType(ResourceType.MATERIAL);
            }
         }

         m_eventManager.fireResourceReadEvent(resource);
      }
   }
1231567
public File extractData(
                    final ClientHttpResponse response
                    )
    throws IOException
    {
        IoUtil.copy( response.getBody(), _file );

        return _file;
    }
1051623
private void go() throws IOException {
    long start = System.currentTimeMillis();
    System.out.println("Decompressing image file: " + inputFile + " to "
        + outputFile);
    DataInputStream in = null;
    DataOutputStream out = null;

    try {
      // setup in
      PositionTrackingInputStream ptis = new PositionTrackingInputStream(
          new FileInputStream(new File(inputFile)));
      in = new DataInputStream(ptis);

      // read header information
      int imgVersion = in.readInt();
      if (!LayoutVersion.supports(Feature.FSIMAGE_COMPRESSION, imgVersion)) {
        System.out
            .println("Image is not compressed. No output will be produced.");
        return;
      }
      int namespaceId = in.readInt();
      long numFiles = in.readLong();
      long genstamp = in.readLong();

      long imgTxId = -1;
      if (LayoutVersion.supports(Feature.STORED_TXIDS, imgVersion)) {
        imgTxId = in.readLong();
      }
      FSImageCompression compression = FSImageCompression
          .readCompressionHeader(new Configuration(), in);
      if (compression.isNoOpCompression()) {
        System.out
            .println("Image is not compressed. No output will be produced.");
        return;
      }
      in = BufferedByteInputStream.wrapInputStream(
          compression.unwrapInputStream(in), FSImage.LOAD_SAVE_BUFFER_SIZE,
          FSImage.LOAD_SAVE_CHUNK_SIZE);
      System.out.println("Starting decompression.");

      // setup output
      out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(
          outputFile)));

      // write back the uncompressed information
      out.writeInt(imgVersion);
      out.writeInt(namespaceId);
      out.writeLong(numFiles);
      out.writeLong(genstamp);
      if (LayoutVersion.supports(Feature.STORED_TXIDS, imgVersion)) {
        out.writeLong(imgTxId);
      }
      // no compression
      out.writeBoolean(false);

      // copy the data
      long size = new File(inputFile).length();
      // read in 1MB chunks
      byte[] block = new byte[1024 * 1024];
      while (true) {
        int bytesRead = in.read(block);
        if (bytesRead <= 0)
          break;
        out.write(block, 0, bytesRead);
        printProgress(ptis.getPos(), size);
      }

      out.close();

      long stop = System.currentTimeMillis();
      System.out.println("Input file : " + inputFile + " size: " + size);
      System.out.println("Output file: " + outputFile + " size: "
          + new File(outputFile).length());
      System.out.println("Decompression completed in " + (stop - start)
          + " ms.");
    } finally {
      if (in != null)
        in.close();
      if (out != null)
        out.close();
    }
  }