Reads the XER file table and row structure ready for processing.

@param is input stream
@throws MPXJException
5782
private void processFile(InputStream is) throws MPXJException
   {
      int line = 1;

      try
      {
         //
         // Test the header and extract the separator. If this is successful,
         // we reset the stream back as far as we can. The design of the
         // BufferedInputStream class means that we can't get back to character
         // zero, so the first record we will read will get "RMHDR" rather than
         // "ERMHDR" in the first field position.
         //
         BufferedInputStream bis = new BufferedInputStream(is);
         byte[] data = new byte[6];
         data[0] = (byte) bis.read();
         bis.mark(1024);
         bis.read(data, 1, 5);

         if (!new String(data).equals("ERMHDR"))
         {
            throw new MPXJException(MPXJException.INVALID_FILE);
         }

         bis.reset();

         InputStreamReader reader = new InputStreamReader(bis, getCharset());
         Tokenizer tk = new ReaderTokenizer(reader);
         tk.setDelimiter('\t');
         List<String> record = new ArrayList<String>();

         while (tk.getType() != Tokenizer.TT_EOF)
         {
            readRecord(tk, record);
            if (!record.isEmpty())
            {
               if (processRecord(record))
               {
                  break;
               }
            }
            ++line;
         }
      }

      catch (Exception ex)
      {
         throw new MPXJException(MPXJException.READ_ERROR + " (failed at line " + line + ")", ex);
      }
   }
6337
public void read(InputStream is, String encoding, final TagListener listener) {

		mSaxHandler.initialize();

		Reader reader = null;

		try {

			reader = new InputStreamReader(is, encoding);

			SAXParserFactory spf = SAXParserFactory.newInstance();

			// To correspond to a big entities
			spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);

			XMLReader xmlReader;

			xmlReader = spf.newSAXParser().getXMLReader();

			mSaxHandler.setTagEventListener(new TagEventListener() {

				@Override
				public void onTagStarted(String fullTagName, String tagName) {
					if (listener != null) {
						listener.onTagStarted(BigXmlReader.this, fullTagName, tagName);
					}
				}

				@Override
				public void onTagFinished(String fullTagName, String tagName, String value, Attributes atts) {
					if (listener != null) {
						listener.onTagFinished(BigXmlReader.this, fullTagName, tagName, value, atts);
					}
				}
			});

			xmlReader.setContentHandler(mSaxHandler);
			InputSource iso = new InputSource(reader);

			xmlReader.parse(iso);

		} catch (BasicSAXHandlerException e) {
			// Force stopped
		} catch (ParserConfigurationException e) {
			e.printStackTrace();
		} catch (SAXException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}
331574
private void processProjectProperties() throws MPXJException, IOException
   {
      Props8 props = new Props8(new DocumentInputStream(((DocumentEntry) m_projectDir.getEntry("Props"))));
      ProjectPropertiesReader reader = new ProjectPropertiesReader();
      reader.process(m_file, props, m_root);
   }
1349030
public List<XLog> parse(InputStream is) throws Exception {
		BufferedInputStream bis = new BufferedInputStream(is);
		// set up a specialized SAX2 handler to fill the container
		XesXmlHandler handler = new XesXmlHandler();
		// set up SAX parser and parse provided log file into the container
		SAXParserFactory parserFactory = SAXParserFactory.newInstance();
		parserFactory.setNamespaceAware(false);
		SAXParser parser = parserFactory.newSAXParser();
		parser.parse(bis, handler);
		bis.close();
		ArrayList<XLog> wrapper = new ArrayList<XLog>();
		wrapper.add(handler.getLog());
		return wrapper;
	}
780309
private void processProjectProperties() throws MPXJException
   {
      ProjectPropertiesReader reader = new ProjectPropertiesReader();
      reader.process(m_file, m_projectProps, m_root);
   }
714695
public void process(Reader reader, SheetToCSV sheetToCSV) throws IOException, OpenXML4JException, SAXException {
        ReadOnlySharedStringsTable strings    = new ReadOnlySharedStringsTable(sheetToCSV.getOpcPackage());
        XSSFReader                 xssfReader = new XSSFReader(sheetToCSV.getOpcPackage());
        StylesTable                styles     = xssfReader.getStylesTable();
        XSSFReader.SheetIterator   iter       = (XSSFReader.SheetIterator) xssfReader.getSheetsData();
        int                        index      = 0;

        boolean bySheetName = StringUtil.isNotEmpty(reader.sheetName());

        while (iter.hasNext()) {
            try (InputStream stream = iter.next()) {
                String sheetName = iter.getSheetName();
                if (bySheetName && reader.sheetName().equals(sheetName)) {
                    processSheet(styles, strings, sheetToCSV, stream);
                    break;
                }
                if (!bySheetName && reader.sheetIndex() == index) {
                    processSheet(styles, strings, sheetToCSV, stream);
                    break;
                }
            }
            ++index;
        }
    }
71464
public static void readBySax(InputStream in, int sheetIndex, RowHandler rowHandler) {
		in = IoUtil.toMarkSupportStream(in);
		if (ExcelFileUtil.isXlsx(in)) {
			read07BySax(in, sheetIndex, rowHandler);
		} else {
			read03BySax(in, sheetIndex, rowHandler);
		}
	}
253861
private void readSegments()
    throws IOException
  {
    for (SegmentExtent10 extent : _segmentExtents) {
      try (ReadStream is = openRead(extent.address(), extent.length())) {
        is.skip(extent.length() - BLOCK_SIZE);
        
        long sequence = BitsUtil.readLong(is);
        
        byte []tableKey = new byte[TABLE_KEY_SIZE];
        is.readAll(tableKey, 0, tableKey.length);
        
        // XXX: crc
        
        if (sequence > 0) {
          Segment10 segment = new Segment10(sequence, tableKey, extent);
          
          _segments.add(segment);
        }
      }
    }
  }
5723
private void getNextFile(final InputStream is) throws IOException {
    if (is instanceof  java.util.zip.ZipInputStream) {
      ZipEntry ze = ((ZipInputStream) is).getNextEntry();
      while (ze != null && ze.isDirectory())
        ze = ((ZipInputStream) is).getNextEntry();
    }
  }
1281842
void readCheckpointDelta(TableKelp table,
                           PageServiceImpl pageActor,
                           ReadStream is,
                           int length)
    throws IOException
  {
    Row row = table.row();
    
    // int keyLength = row.getKeyLength();
    int removeLength = row.removeLength();
    int rowLength = row.length();
    
    BlockLeaf block = _blocks[0];

    long endPosition = is.position() + length;
    int rowHead = block.rowHead();
    int blobTail = block.getBlobTail();
    long pos;

    while ((pos = is.position()) < endPosition) {
      int code = is.read();
      is.unread();
      
      code = code & CODE_MASK;
      
      if (code == REMOVE) {
        rowHead -= removeLength;
        
        if (rowHead < blobTail) {
          block = extendBlocks();

          rowHead = BLOCK_SIZE - removeLength;
          blobTail = 0;
        }
        
        is.readAll(block.getBuffer(), rowHead, removeLength);
      }
      else if (code == INSERT) {
        rowHead -= rowLength;
      
        while ((blobTail = row.readCheckpoint(is, block.getBuffer(), 
                                              rowHead, blobTail)) < 0) {
          //is.setPosition(pos + 1);
          is.position(pos);

          block = extendBlocks();

          rowHead = BLOCK_SIZE - rowLength;
          blobTail = 0;
        }
      
        // byte []buffer = block.getBuffer();
        // buffer[rowHead] = (byte) ((buffer[rowHead] & ~CODE_MASK) | INSERT);
      }
      else {
        throw new IllegalStateException(L.l("{0} Corrupted checkpoint at pos={1} with code {2}",
                                            this, pos, code));
      }
      
      block.rowHead(rowHead);
      block.setBlobTail(blobTail);
    }

    clearDirty();
    
    validate(table);
  }
177013
public Object read(InputStream is, Class type, MediaType mediaType)
            throws IOException {
        XStream xstream = getXStreamInstance(mediaType);
        if (xstream != null) {
            return xstream.fromXML(is);
        } else {
            throw new IllegalArgumentException("Content-type: "
                    + mediaType.getType() + " is currently not supported for "
                    + type.getName());
        }
    }
761151
public Map<Integer, String> listProjects(InputStream is) throws MPXJException
   {
      try
      {
         m_tables = new HashMap<String, List<Row>>();
         processFile(is);

         Map<Integer, String> result = new HashMap<Integer, String>();

         List<Row> rows = getRows("project", null, null);
         for (Row row : rows)
         {
            Integer id = row.getInteger("proj_id");
            String name = row.getString("proj_short_name");
            result.put(id, name);
         }

         return result;
      }

      finally
      {
         m_tables = null;
         m_currentTable = null;
         m_currentFieldNames = null;
      }
   }
1244573
private void readObject(java.io.ObjectInputStream s)
        throws java.io.IOException, ClassNotFoundException  {
        // Read in any hidden stuff
        s.defaultReadObject();

        // Read in size (number of Mappings)
        int size = s.readInt();
        if (size < 0)
            throw new java.io.StreamCorruptedException
                ("Illegal mappings count: " + size);
        init(capacity(size));

        // Read the keys and values, and put the mappings in the table
        for (int i=0; i<size; i++) {
            @SuppressWarnings("unchecked")
                K key = (K) s.readObject();
            @SuppressWarnings("unchecked")
                V value = (V) s.readObject();
            putForCreate(key, value);
        }
    }
1091230
public void process(InputStream is) throws Exception
   {
      readHeader(is);
      readVersion(is);
      readTableData(readTableHeaders(is), is);
   }
1167317
@Override public void process(MPPReader reader, ProjectFile file, DirectoryEntry root) throws MPXJException, IOException
   {
      try
      {
         populateMemberData(reader, file, root);
         processProjectProperties();

         if (!reader.getReadPropertiesOnly())
         {
            processCalendarData();
            processResourceData();
            processTaskData();
            processConstraintData();
            processAssignmentData();

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

      finally
      {
         clearMemberData();
      }
   }
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();
      }
   }
1091885
private ProjectFile readProjectFile(ProjectReader reader, InputStream stream) throws MPXJException
   {
      addListeners(reader);
      return reader.read(stream);
   }