private byte[] readData(FormatConverter converter, InputStream inputStream, LodResource lodResource) throws IOException {
            int length = 64;
            InputStream convertedInputStream = null;
            byte[] data = null;
            if (null == converter)
            {
                convertedInputStream = inputStream;
                
              data = new byte[length];
              int total = 0;
              while (total < length)
              {
                  int count = convertedInputStream.read(data, total, (length - total));
                  if (-1 == count)  break;
                    
                  total += count;
              }
            
            }
            else
            {
                converter.setSourceInputStreamForNewFormat(inputStream, lodResource);
                convertedInputStream = converter.getDestinationInputStreamForOldFormat();

                // TODO: recombine the data reading?
                data = new byte[length];
                int total = 0;
                int count = 0;
                while (-1 != count)
                {
                    if (total >= data.length)
                    {
                        byte[] newData = new byte[data.length * 2];
                        System.arraycopy(data, 0, newData, 0, data.length);
                        data = newData;
                    }
                
                    count = convertedInputStream.read(data, total, (data.length - total));
                    if (-1 == count)  break;
                    
                    total += count;
                }

                if (total != data.length)
                {
                    byte[] newData = new byte[total];
                    System.arraycopy(data, 0, newData, 0, total);
                    data = newData;
                }

            }


            return data;
        }