Initializes this header from the specified file. Looks for the right
version and reads the integer value of {@link #pageSize} from the file.
340541
@Override
  public void readHeader(RandomAccessFile file) throws IOException {
    file.seek(0);
    if(file.readInt() != FILE_VERSION) {
      throw new RuntimeException("File " + file + " is not a PersistentPageFile or wrong version!");
    }

    this.pageSize = file.readInt();
  }
882857
public void readHeader(ReadBuffer readBuffer, long fileSize) throws IOException {
        RequiredFields.readMagicByte(readBuffer);
        RequiredFields.readRemainingHeader(readBuffer);

        MapFileInfoBuilder mapFileInfoBuilder = new MapFileInfoBuilder();

        RequiredFields.readFileVersion(readBuffer, mapFileInfoBuilder);

        RequiredFields.readFileSize(readBuffer, fileSize, mapFileInfoBuilder);

        RequiredFields.readMapDate(readBuffer, mapFileInfoBuilder);

        RequiredFields.readBoundingBox(readBuffer, mapFileInfoBuilder);

        RequiredFields.readTilePixelSize(readBuffer, mapFileInfoBuilder);

        RequiredFields.readProjectionName(readBuffer, mapFileInfoBuilder);

        OptionalFields.readOptionalFields(readBuffer, mapFileInfoBuilder);

        RequiredFields.readPoiTags(readBuffer, mapFileInfoBuilder);

        RequiredFields.readWayTags(readBuffer, mapFileInfoBuilder);

        readSubFileParameters(readBuffer, fileSize, mapFileInfoBuilder);

        this.mapFileInfo = mapFileInfoBuilder.build();
    }
119940
@MustBeLocked (ELockType.WRITE)
  protected final void initialRead () throws DAOException
  {
    File aFile = null;
    final String sFilename = m_aFilenameProvider.get ();
    if (sFilename == null)
    {
      // required for testing
      if (!isSilentMode ())
        if (LOGGER.isWarnEnabled ())
          LOGGER.warn ("This DAO of class " + getClass ().getName () + " will not be able to read from a file");

      // do not return - run initialization anyway
    }
    else
    {
      // Check consistency
      aFile = getSafeFile (sFilename, EMode.READ);
    }

    final File aFinalFile = aFile;
    m_aRWLock.writeLockedThrowing ( () -> {
      final boolean bIsInitialization = aFinalFile == null || !aFinalFile.exists ();
      try
      {
        ESuccess eWriteSuccess = ESuccess.SUCCESS;
        if (bIsInitialization)
        {
          // initial setup for non-existing file
          if (isDebugLogging ())
            if (LOGGER.isInfoEnabled ())
              LOGGER.info ("Trying to initialize DAO XML file '" + aFinalFile + "'");

          beginWithoutAutoSave ();
          try
          {
            m_aStatsCounterInitTotal.increment ();
            final StopWatch aSW = StopWatch.createdStarted ();

            if (onInit ().isChanged ())
              if (aFinalFile != null)
                eWriteSuccess = _writeToFile ();

            m_aStatsCounterInitTimer.addTime (aSW.stopAndGetMillis ());
            m_aStatsCounterInitSuccess.increment ();
            m_nInitCount++;
            m_aLastInitDT = PDTFactory.getCurrentLocalDateTime ();
          }
          finally
          {
            endWithoutAutoSave ();
            // reset any pending changes, because the initialization should
            // be read-only. If the implementing class changed something,
            // the return value of onInit() is what counts
            internalSetPendingChanges (false);
          }
        }
        else
        {
          // Read existing file
          if (isDebugLogging ())
            if (LOGGER.isInfoEnabled ())
              LOGGER.info ("Trying to read DAO XML file '" + aFinalFile + "'");

          m_aStatsCounterReadTotal.increment ();
          final IMicroDocument aDoc = MicroReader.readMicroXML (aFinalFile);
          if (aDoc == null)
          {
            if (LOGGER.isErrorEnabled ())
              LOGGER.error ("Failed to read XML document from file '" + aFinalFile + "'");
          }
          else
          {
            // Valid XML - start interpreting
            beginWithoutAutoSave ();
            try
            {
              final StopWatch aSW = StopWatch.createdStarted ();

              if (onRead (aDoc).isChanged ())
                eWriteSuccess = _writeToFile ();

              m_aStatsCounterReadTimer.addTime (aSW.stopAndGetMillis ());
              m_aStatsCounterReadSuccess.increment ();
              m_nReadCount++;
              m_aLastReadDT = PDTFactory.getCurrentLocalDateTime ();
            }
            finally
            {
              endWithoutAutoSave ();
              // reset any pending changes, because the initialization should
              // be read-only. If the implementing class changed something,
              // the return value of onRead() is what counts
              internalSetPendingChanges (false);
            }
          }
        }

        // Check if writing was successful on any of the 2 branches
        if (eWriteSuccess.isSuccess ())
          internalSetPendingChanges (false);
        else
        {
          if (LOGGER.isWarnEnabled ())
            LOGGER.warn ("File '" + aFinalFile + "' has pending changes after initialRead!");
        }
      }
      catch (final Exception ex)
      {
        triggerExceptionHandlersRead (ex, bIsInitialization, aFinalFile);
        throw new DAOException ("Error " +
                                (bIsInitialization ? "initializing" : "reading") +
                                " the file '" +
                                aFinalFile +
                                "'",
                                ex);
      }
    });
  }
699073
static BlockMetadataHeader readHeader(File file) throws IOException {
    DataInputStream in = null;
    try {
      in = new DataInputStream(new BufferedInputStream(
                               new FileInputStream(file)));
      return readHeader(in);
    } finally {
      IOUtils.closeStream(in);
    }
  }
695621
public static Hml read(final File file) throws IOException {
        checkNotNull(file);
        try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
            return read(reader);
        }
    }
1125914
private void initialize() {
//		if (selection != null && selection.isEmpty() == false
//				&& selection instanceof IStructuredSelection) {
//			IStructuredSelection ssel = (IStructuredSelection) selection;
//			if (ssel.size() > 1)
//				return;
//			Object obj = ssel.getFirstElement();
//			if (obj instanceof IResource) {
//				IContainer container;
//				if (obj instanceof IContainer)
//					container = (IContainer) obj;
//				else
//					container = ((IResource) obj).getParent();
//				containerText.setText(container.getFullPath().toString());
//			}
//		}
		System.err.println("### Set default selected MuleVersion to index: " + muleVersionCombo.getItemCount());
		muleVersionCombo.select(muleVersionCombo.getItemCount() - 1);
	}
54353
public void initBackingIndexNew(IOResourceProvider file) {
		if (idx != null) {
			throw new IllegalStateException();
		}
		//8 byte page, 1 byte flag 
		idx = new PagedUniqueLongLong(PAGE_TYPE.FREE_INDEX, file, 4, 8);
		iter = idx.iterator(1, Long.MAX_VALUE);
	}
105508
public void read() throws IOException {
    readFileId();
    in.resetCRC();

    long startcode = in.readStartCode();

    while (true) {
      // Start parsing main and stream information
      header = new MainHeaderPacket();

      if (!Startcode.MAIN.equalsCode(startcode)) {
        throw new IOException(String.format("expected main header found: 0x%X", startcode));
      }

      header.read(in, startcode);
      startcode = readReservedHeaders();

      streams.clear();
      for (int i = 0; i < header.streamCount; i++) {
        if (!Startcode.STREAM.equalsCode(startcode)) {
          throw new IOException(String.format("expected stream header found: 0x%X", startcode));
        }

        StreamHeaderPacket streamHeader = new StreamHeaderPacket();
        streamHeader.read(in, startcode);

        Stream stream = new Stream(header, streamHeader);
        streams.add(stream);
        listener.stream(stream);

        startcode = readReservedHeaders();
      }

      while (Startcode.INFO.equalsCode(startcode)) {
        new Packet().read(in, startcode); // Discard for the moment
        startcode = readReservedHeaders();
      }

      if (Startcode.INDEX.equalsCode(startcode)) {
        new Packet().read(in, startcode); // Discard for the moment
        startcode = in.readStartCode();
      }

      // Now main frame parsing loop
      while (!Startcode.MAIN.equalsCode(startcode)) {

        if (Startcode.SYNCPOINT.equalsCode(startcode)) {
          new Packet().read(in, startcode); // Discard for the moment
          startcode = in.readStartCode();
        }

        if (Startcode.isPossibleStartcode(startcode)) {
          throw new IOException("expected framecode, found " + Startcode.toString(startcode));
        }

        Frame f = new Frame();
        f.read(this, in, (int) startcode);

        listener.frame(f);

        try {
          startcode = readReservedHeaders();
        } catch (java.io.EOFException e) {
          return;
        }
      }
    }
  }
901255
private void init() {
        mHeaderFields = new Hashtable<>();
        mStartLine = "";
        mMsgHeader = "";
        mMalformedHeader = false;
        mContentLength = -1;
        mLineDelimiter = CRLF;
        mVersion = HttpHeader.HTTP10;
    }
419695
@Override
    protected void initializeImpl()
    {
        this.submitFileContentParameter=this.getConfigurationValue(FaxJob2HTTPRequestConverterConfigurationConstants.SUBMIT_ACTION_FILE_CONTENT_PARAMETER_NAME_PROPERTY_KEY);
        if(this.submitFileContentParameter==null)
        {
            this.submitFileContentParameter="file";
        }
        this.submitFileNameParameter=this.getConfigurationValue(FaxJob2HTTPRequestConverterConfigurationConstants.SUBMIT_ACTION_FILE_NAME_PARAMETER_NAME_PROPERTY_KEY);
        if(this.submitFileNameParameter==null)
        {
            this.submitFileNameParameter="filename";
        }
        this.submitTargetAddressParameter=this.getConfigurationValue(FaxJob2HTTPRequestConverterConfigurationConstants.SUBMIT_ACTION_TARGET_ADDRESS_PARAMETER_NAME_PROPERTY_KEY);
        if(this.submitTargetAddressParameter==null)
        {
            this.submitTargetAddressParameter="targetaddress";
        }
        this.submitTargetNameParameter=this.getConfigurationValue(FaxJob2HTTPRequestConverterConfigurationConstants.SUBMIT_ACTION_TARGET_NAME_PARAMETER_NAME_PROPERTY_KEY);
        if(this.submitTargetNameParameter==null)
        {
            this.submitTargetNameParameter="targetname";
        }
        this.submitSenderNameParameter=this.getConfigurationValue(FaxJob2HTTPRequestConverterConfigurationConstants.SUBMIT_ACTION_SENDER_NAME_PARAMETER_NAME_PROPERTY_KEY);
        if(this.submitSenderNameParameter==null)
        {
            this.submitSenderNameParameter="sendername";
        }
        this.submitSenderFaxNumberParameter=this.getConfigurationValue(FaxJob2HTTPRequestConverterConfigurationConstants.SUBMIT_ACTION_SENDER_FAX_NUMBER_PARAMETER_NAME_PROPERTY_KEY);
        if(this.submitSenderFaxNumberParameter==null)
        {
            this.submitSenderFaxNumberParameter="senderfaxnumber";
        }
        this.submitSenderEMailParameter=this.getConfigurationValue(FaxJob2HTTPRequestConverterConfigurationConstants.SUBMIT_ACTION_SENDER_EMAIL_PARAMETER_NAME_PROPERTY_KEY);
        if(this.submitSenderEMailParameter==null)
        {
            this.submitSenderEMailParameter="senderemail";
        }
        this.suspendFaxJobIDParameter=this.getConfigurationValue(FaxJob2HTTPRequestConverterConfigurationConstants.SUSPEND_ACTION_FAX_JOB_ID_PARAMETER_NAME_PROPERTY_KEY);
        if(this.suspendFaxJobIDParameter==null)
        {
            this.suspendFaxJobIDParameter="faxjobid";
        }
        this.resumeFaxJobIDParameter=this.getConfigurationValue(FaxJob2HTTPRequestConverterConfigurationConstants.RESUME_ACTION_FAX_JOB_ID_PARAMETER_NAME_PROPERTY_KEY);
        if(this.resumeFaxJobIDParameter==null)
        {
            this.resumeFaxJobIDParameter="faxjobid";
        }
        this.cancelFaxJobIDParameter=this.getConfigurationValue(FaxJob2HTTPRequestConverterConfigurationConstants.CANCEL_ACTION_FAX_JOB_ID_PARAMETER_NAME_PROPERTY_KEY);
        if(this.cancelFaxJobIDParameter==null)
        {
            this.cancelFaxJobIDParameter="faxjobid";
        }
        this.getStatusFaxJobIDParameter=this.getConfigurationValue(FaxJob2HTTPRequestConverterConfigurationConstants.GET_FAX_JOB_STATUS_ACTION_FAX_JOB_ID_PARAMETER_NAME_PROPERTY_KEY);
        if(this.getStatusFaxJobIDParameter==null)
        {
            this.getStatusFaxJobIDParameter="faxjobid";
        }
        this.addFileNamePart=true;
        String value=this.getConfigurationValue(FaxJob2HTTPRequestConverterConfigurationConstants.ADD_FILE_NAME_AS_PART_PROPERTY_KEY);
        if(value!=null)
        {
            this.addFileNamePart=Boolean.parseBoolean(value);
        }
        
        //initialize additional parameters
        this.additionalParameters=this.initializeAdditionalParameters();
        if(this.additionalParameters!=null)
        {
            //normalize for best performance
            this.additionalParameters=new HashMap<String,String>(this.additionalParameters);
            
            //protect from modification
            this.additionalParameters=Collections.unmodifiableMap(this.additionalParameters);
        }
    }
736007
private static InputStream getFileAsInputStream(String file) throws InitializationException {
		if (file == null) {
			throw new NullPointerException("File is null");
		}
		try {
			return new FileInputStream(new File(file));
		} catch (FileNotFoundException e) {
			throw new InitializationException("File not found: " + file);
		}
	}
525598
@Override
    public void init(PageContext pc) throws IOException {
	if (init != null) {
	    try {
		init.invoke(monitor, new Object[] { pc });
	    }
	    catch (Exception e) {
		throw ExceptionUtil.toIOException(e);
	    }
	}
    }
1078110
@Override
	public void open(FileInputSplit split) throws IOException {
		super.open(split);
		LOG.debug("Initialize Bitcoin reader");
		// temporary measure to set buffer size to 1, otherwise we cannot guarantee that checkpointing works
		bbr = new BitcoinBlockReader(this.stream,this.maxSizeBitcoinBlock,1,this.specificMagicArray,this.useDirectBuffer,this.readAuxPOW);
	}
1063063
private void init(InputStream in) throws java.io.IOException {
        if (in.available() > 2000000) {
        	throw new IOException("Font too big");
        }
        this.file = IOUtils.toByteArray(in);
        this.fsize = this.file.length;
        if (fsize > 2000000) {
        	throw new IOException("Font too big");
        }
        this.current = 0;
    }
210809
Header readHeader(@NonNull ArrayView input) throws SerializationException {
        byte version = input.get(VERSION_POSITION);
        int keyLength = BitConverter.readInt(input, KEY_POSITION);
        int valueLength = BitConverter.readInt(input, VALUE_POSITION);
        long entryVersion = BitConverter.readLong(input, ENTRY_VERSION_POSITION);
        validateHeader(keyLength, valueLength);
        return new Header(version, keyLength, valueLength, entryVersion);
    }
858636
public void init() throws IOException {
    if (!Files.exists(path)) {
      throw new FileNotFoundException(
          "Could not find a file under path: " + path.toAbsolutePath().toString());
    }
    if (Files.size(path) == 0) {
      throw new IllegalStateException("File size can't be zero for chunked files");
    }
    chunks = chunkFile();
    chunksInUse = new ConcurrentSkipListMap<>();
    chunksPreRead = new ConcurrentSkipListMap<>();
    chunksScheduled = new ConcurrentSkipListMap<>();
    nextChunkNum = new AtomicInteger(-1);
    if (raf != null) {
      raf.close();
    }
    execIo = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());
    execFinalize = Executors.newSingleThreadExecutor();
  }
4599
private void init(ByteBuffer inBytes) throws IOException {
        dataVersion = ICUBinary.readHeader(inBytes, DATA_FORMAT, IS_ACCEPTABLE);
        int majorFormatVersion = inBytes.get(16);
        bytes = ICUBinary.sliceWithOrder(inBytes);
        int dataLength = bytes.remaining();

        if(DEBUG) System.out.println("The ByteBuffer is direct (memory-mapped): " + bytes.isDirect());
        if(DEBUG) System.out.println("The available bytes in the buffer before reading the data: " + dataLength);

        rootRes = bytes.getInt(0);

        // Bundles with formatVersion 1.1 and later contain an indexes[] array.
        // We need it so that we can read the key string bytes up front, for lookup performance.

        // read the variable-length indexes[] array
        int indexes0 = getIndexesInt(URES_INDEX_LENGTH);
        int indexLength = indexes0 & 0xff;
        if(indexLength <= URES_INDEX_MAX_TABLE_LENGTH) {
            throw new ICUException("not enough indexes");
        }
        int bundleTop;
        if(dataLength < ((1 + indexLength) << 2) ||
                dataLength < ((bundleTop = getIndexesInt(URES_INDEX_BUNDLE_TOP)) << 2)) {
            throw new ICUException("not enough bytes");
        }
        int maxOffset = bundleTop - 1;

        if (majorFormatVersion >= 3) {
            // In formatVersion 1, the indexLength took up this whole int.
            // In version 2, bits 31..8 were reserved and always 0.
            // In version 3, they contain bits 23..0 of the poolStringIndexLimit.
            // Bits 27..24 are in indexes[URES_INDEX_ATTRIBUTES] bits 15..12.
            poolStringIndexLimit = indexes0 >>> 8;
        }
        if(indexLength > URES_INDEX_ATTRIBUTES) {
            // determine if this resource bundle falls back to a parent bundle
            // along normal locale ID fallback
            int att = getIndexesInt(URES_INDEX_ATTRIBUTES);
            noFallback = (att & URES_ATT_NO_FALLBACK) != 0;
            isPoolBundle = (att & URES_ATT_IS_POOL_BUNDLE) != 0;
            usesPoolBundle = (att & URES_ATT_USES_POOL_BUNDLE) != 0;
            poolStringIndexLimit |= (att & 0xf000) << 12;  // bits 15..12 -> 27..24
            poolStringIndex16Limit = att >>> 16;
        }

        int keysBottom = 1 + indexLength;
        int keysTop = getIndexesInt(URES_INDEX_KEYS_TOP);
        if(keysTop > keysBottom) {
            // Deserialize the key strings up front.
            // Faster table item search at the cost of slower startup and some heap memory.
            if(isPoolBundle) {
                // Shift the key strings down:
                // Pool bundle key strings are used with a 0-based index,
                // unlike regular bundles' key strings for which indexes
                // are based on the start of the bundle data.
                keyBytes = new byte[(keysTop - keysBottom) << 2];
                bytes.position(keysBottom << 2);
            } else {
                localKeyLimit = keysTop << 2;
                keyBytes = new byte[localKeyLimit];
            }
            bytes.get(keyBytes);
        }

        // Read the array of 16-bit units.
        if(indexLength > URES_INDEX_16BIT_TOP) {
            int _16BitTop = getIndexesInt(URES_INDEX_16BIT_TOP);
            if(_16BitTop > keysTop) {
                int num16BitUnits = (_16BitTop - keysTop) * 2;
                bytes.position(keysTop << 2);
                b16BitUnits = bytes.asCharBuffer();
                b16BitUnits.limit(num16BitUnits);
                maxOffset |= num16BitUnits - 1;
            } else {
                b16BitUnits = EMPTY_16_BIT_UNITS;
            }
        } else {
            b16BitUnits = EMPTY_16_BIT_UNITS;
        }

        if(indexLength > URES_INDEX_POOL_CHECKSUM) {
            poolCheckSum = getIndexesInt(URES_INDEX_POOL_CHECKSUM);
        }

        if(!isPoolBundle || b16BitUnits.length() > 1) {
            resourceCache = new ResourceCache(maxOffset);
        }

        // Reset the position for future .asCharBuffer() etc.
        bytes.position(0);
    }