private void readTable(InputStream is, SynchroTable table) throws IOException
   {
      int skip = table.getOffset() - m_offset;
      if (skip != 0)
      {
         StreamHelper.skip(is, skip);
         m_offset += skip;
      }

      String tableName = DatatypeConverter.getString(is);
      int tableNameLength = 2 + tableName.length();
      m_offset += tableNameLength;

      int dataLength;
      if (table.getLength() == -1)
      {
         dataLength = is.available();
      }
      else
      {
         dataLength = table.getLength() - tableNameLength;
      }

      SynchroLogger.log("READ", tableName);

      byte[] compressedTableData = new byte[dataLength];
      is.read(compressedTableData);
      m_offset += dataLength;

      Inflater inflater = new Inflater();
      inflater.setInput(compressedTableData);
      ByteArrayOutputStream outputStream = new ByteArrayOutputStream(compressedTableData.length);
      byte[] buffer = new byte[1024];
      while (!inflater.finished())
      {
         int count;

         try
         {
            count = inflater.inflate(buffer);
         }
         catch (DataFormatException ex)
         {
            throw new IOException(ex);
         }
         outputStream.write(buffer, 0, count);
      }
      outputStream.close();
      byte[] uncompressedTableData = outputStream.toByteArray();

      SynchroLogger.log(uncompressedTableData);

      m_tableData.put(table.getName(), uncompressedTableData);
   }
private void readTable ( InputStream is , SynchroTable table ) throws IOException { int skip = table . getOffset ( ) - m_offset ; if ( skip != 0 ) { StreamHelper . skip ( is , skip ) ; m_offset += skip ; } String tableName = DatatypeConverter . getString ( is ) ; int tableNameLength = 2 + tableName . length ( ) ; m_offset += tableNameLength ; int dataLength ; if ( table . getLength ( ) == - 1 ) { dataLength = is . available ( ) ; } else { dataLength = table . getLength ( ) - tableNameLength ; } SynchroLogger . log ( "READ" , tableName ) ; byte [ ] compressedTableData = new byte [ dataLength ] ; is . read ( compressedTableData ) ; m_offset += dataLength ; Inflater inflater = new Inflater ( ) ; inflater . setInput ( compressedTableData ) ; ByteArrayOutputStream outputStream = new ByteArrayOutputStream ( compressedTableData . length ) ; byte [ ] buffer = new byte [ 1024 ] ; while ( ! inflater . finished ( ) ) { int count ; try { count = inflater . inflate ( buffer ) ; } catch ( DataFormatException ex ) { throw new IOException ( ex ) ; } outputStream . write ( buffer , 0 , count ) ; } outputStream . close ( ) ; byte [ ] uncompressedTableData = outputStream . toByteArray ( ) ; SynchroLogger . log ( uncompressedTableData ) ; m_tableData . put ( table . getName ( ) , uncompressedTableData ) ; }
Read data for a single table and store it.

@param is input stream
@param table table header