Import SURT prefixes from a reader with mixed URI and SURT prefix
format.

@param r  the reader to import the prefixes from
@param deduceFromSeeds   true to also import SURT prefixes implied
from normal URIs/hostname seeds
356575
public void importFromMixed(Reader r, boolean deduceFromSeeds) {
        BufferedReader reader = new BufferedReader(r);
        String s;
        
        Iterator<String> iter = 
            new RegexLineIterator(
                    new LineReadingIterator(reader),
                    RegexLineIterator.COMMENT_LINE,
                    RegexLineIterator.NONWHITESPACE_ENTRY_TRAILING_COMMENT,
                    RegexLineIterator.ENTRY);

        while (iter.hasNext()) {
            s = (String) iter.next();
            if(s.startsWith(SURT_PREFIX_DIRECTIVE)) {
                considerAsAddDirective(s.substring(SURT_PREFIX_DIRECTIVE.length()));
                continue; 
            } else {
                if(deduceFromSeeds) {
                    // also deducing 'implied' SURT prefixes 
                    // from normal URIs/hostname seeds
                    addFromPlain(s);
                }
            }
        }
    }
877457
@Override
	public void addResourceReader(ResourceReader rd) {

		if (rd instanceof TextResourceReader) {
			resourceReaders.add((TextResourceReader) rd);
			Collections.sort(resourceReaders, new ResourceReaderComparator(config));
		}

		if (rd instanceof StreamResourceReader) {
			streamResourceReaders.add((StreamResourceReader) rd);
			Collections.sort(streamResourceReaders, new ResourceReaderComparator(config));
		}

		initReader(rd);
	}
809496
public ImportDescr importStatement(PackageDescrBuilder pkg) throws RecognitionException {
        try {
            String kwd;
            if (helper.validateLT(2, kwd = DroolsSoftKeywords.ACC) ||
                    helper.validateLT(2, kwd = DroolsSoftKeywords.ACCUMULATE)) {
                AccumulateImportDescrBuilder imp = helper.start(pkg,
                        AccumulateImportDescrBuilder.class,
                        null);

                try {
                    // import
                    match(input,
                            DRL6Lexer.ID,
                            DroolsSoftKeywords.IMPORT,
                            null,
                            DroolsEditorType.KEYWORD);
                    if (state.failed)
                        return null;

                    // import accumulate
                    match(input,
                            DRL6Lexer.ID,
                            kwd,
                            null,
                            DroolsEditorType.KEYWORD);
                    if (state.failed)
                        return null;

                    // qualifiedIdentifier
                    String target = qualifiedIdentifier();
                    if (state.failed)
                        return null;
                    
                    // function name
                    Token id = match(input,
                            DRL6Lexer.ID,
                            null,
                            null,
                            DroolsEditorType.IDENTIFIER);
                    if (state.failed)
                        return null;
                    if (state.backtracking == 0) {
                        imp.target(target).functionName(id.getText());
                    }

                    return (imp != null) ? imp.getDescr() : null;
                } finally {
                    helper.end(AccumulateImportDescrBuilder.class,
                            imp);
                }
            } else {
                ImportDescrBuilder imp = helper.start(pkg,
                        ImportDescrBuilder.class,
                        null);

                try {
                    // import
                    match(input,
                            DRL6Lexer.ID,
                            DroolsSoftKeywords.IMPORT,
                            null,
                            DroolsEditorType.KEYWORD);
                    if (state.failed)
                        return null;

                    if (helper.validateIdentifierKey(kwd = DroolsSoftKeywords.FUNCTION) ||
                            helper.validateIdentifierKey(kwd = DroolsSoftKeywords.STATIC)) {
                        // function
                        match(input,
                                DRL6Lexer.ID,
                                kwd,
                                null,
                                DroolsEditorType.KEYWORD);
                        if (state.failed)
                            return null;
                    }

                    // qualifiedIdentifier
                    String target = qualifiedIdentifier();
                    if (state.failed)
                        return null;

                    if (input.LA(1) == DRL6Lexer.DOT && input.LA(2) == DRL6Lexer.STAR) {
                        // .*
                        match(input,
                                DRL6Lexer.DOT,
                                null,
                                null,
                                DroolsEditorType.IDENTIFIER);
                        if (state.failed)
                            return null;
                        match(input,
                                DRL6Lexer.STAR,
                                null,
                                null,
                                DroolsEditorType.IDENTIFIER);
                        if (state.failed)
                            return null;
                        target += ".*";
                    }
                    if (state.backtracking == 0)
                        imp.target(target);
                    return (imp != null) ? imp.getDescr() : null;
                } finally {
                    helper.end(ImportDescrBuilder.class,
                            imp);
                }
            }

        } catch (RecognitionException re) {
            reportError(re);
        }
        return null;
    }
842098
@Deprecated
    public static synchronized void initializeFromURI(
            final URI uri,
            final ClientConfiguration config) {
        try {

            regionMetadata = loadMetadataFromURI(uri, config);

        } catch (IOException exception) {
            throw new SdkClientException(
                    "Error parsing region metadata from " + uri,
                    exception);
        }
    }
1369299
function createDestReadme(srcReadmePath) {
 
    const destReadmePath = srcReadmePath.replace(/(\bpackages\b)(?!.*\1)/, destDir);
    const destDirPath = path.dirname(destReadmePath);
    const srcDirPath = path.dirname(srcReadmePath);
    const srcReadmeText = fs.readFileSync(srcReadmePath).toString();

    var folderName = srcDirPath
        .split(path.sep)
        .pop();

    var lines = fs.readFileSync(srcReadmePath, 'utf-8')
        .split('\n')
        .filter(Boolean);

    var title = lines[0]
        .replace(/#/g, '')
        .replace(/FAST/g, '')
        .trim();
            
    var docusaurusHeader = 
        `---\n` + 
        `id: index\n` + 
        `title: FAST ${title}\n` + 
        `sidebar_label: ${title}\n` +
        `---\n\n`;

    createDirectory(destDirPath);

    if (dryRun) {
        if (fs.existsSync(destReadmePath)) {
            console.log(`...REPLACE readme.md in the '${folderName}' folder`);
        } else {
            console.log(`...ADD readme.md to the '${folderName}' folder`);
        }
    } else {
        try {
            fs.writeFileSync(destReadmePath, docusaurusHeader);
            fs.appendFileSync(destReadmePath, srcReadmeText);
            updatedDocsCount++;
            console.log(`...${folderName} was succesfully updated`);
        } catch (err) {
            console.log(chalk.red(err));
        }
    }

}
766097
void copyFrom(CollationDataBuilder src, CEModifier modifier) {
        if(!isMutable()) {
            throw new IllegalStateException("attempt to copyFrom() after build()");
        }
        CopyHelper helper = new CopyHelper(src, this, modifier);
        Iterator<Trie2.Range> trieIterator = src.trie.iterator();
        Trie2.Range range;
        while(trieIterator.hasNext() && !(range = trieIterator.next()).leadSurrogate) {
            enumRangeForCopy(range.startCodePoint, range.endCodePoint, range.value, helper);
        }
        // Update the contextChars and the unsafeBackwardSet while copying,
        // in case a character had conditional mappings in the source builder
        // and they were removed later.
        modified |= src.modified;
    }
919712
@Override
    public void readFragmentFrom(MwsReader r) {
        listOrdersByNextTokenResult = r.read("ListOrdersByNextTokenResult", ListOrdersByNextTokenResult.class);
        responseMetadata = r.read("ResponseMetadata", ResponseMetadata.class);
    }
502665
private void processINodesUC(DataInputStream in, ImageVisitor v,
      boolean skipBlocks) throws IOException {
    int numINUC = in.readInt();

    v.visitEnclosingElement(ImageElement.INODES_UNDER_CONSTRUCTION,
                           ImageElement.NUM_INODES_UNDER_CONSTRUCTION, numINUC);

    for(int i = 0; i < numINUC; i++) {
      checkInterruption();
      v.visitEnclosingElement(ImageElement.INODE_UNDER_CONSTRUCTION);
      
      byte [] name = FSImageSerialization.readBytes(in);
      String n = new String(name, "UTF8");
      v.visit(ImageElement.INODE_PATH, n);
      
      if (LayoutVersion.supports(Feature.ADD_INODE_ID, imageVersion)) {
        v.visit(ImageElement.INODE_ID, in.readLong());
      }
      
      v.visit(ImageElement.REPLICATION, in.readShort());
      v.visit(ImageElement.MODIFICATION_TIME, formatDate(in.readLong()));

      v.visit(ImageElement.PREFERRED_BLOCK_SIZE, in.readLong());
      int numBlocks = in.readInt();
      processBlocks(in, v, numBlocks, skipBlocks);

      processPermission(in, v);
      v.visit(ImageElement.CLIENT_NAME, FSImageSerialization.readString(in));
      v.visit(ImageElement.CLIENT_MACHINE, FSImageSerialization.readString(in));

      // Skip over the datanode descriptors, which are still stored in the
      // file but are not used by the datanode or loaded into memory
      int numLocs = in.readInt();
      for(int j = 0; j < numLocs; j++) {
        in.readShort();
        in.readLong();
        in.readLong();
        in.readLong();
        in.readInt();
        FSImageSerialization.readString(in);
        FSImageSerialization.readString(in);
        WritableUtils.readEnum(in, AdminStates.class);
      }

      v.leaveEnclosingElement(); // INodeUnderConstruction
    }

    v.leaveEnclosingElement(); // INodesUnderConstruction
  }
926430
@Override
    public void readFragmentFrom(MwsReader r) {
        listOrderItemsByNextTokenResult = r.read("ListOrderItemsByNextTokenResult", ListOrderItemsByNextTokenResult.class);
        responseMetadata = r.read("ResponseMetadata", ResponseMetadata.class);
    }
157015
@Override
    public void readFragmentFrom(MwsReader r) {
        listOrderItemsResult = r.read("ListOrderItemsResult", ListOrderItemsResult.class);
        responseMetadata = r.read("ResponseMetadata", ResponseMetadata.class);
    }
142036
public TypeDefinitionRegistry parse(Reader reader) throws SchemaProblem {
        try (Reader input = reader) {
            return parseImpl(input);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
1205301
@Override
    public void readFragmentFrom(MwsReader r) {
        invoiceRequirement = r.read("InvoiceRequirement", String.class);
        buyerSelectedInvoiceCategory = r.read("BuyerSelectedInvoiceCategory", String.class);
        invoiceTitle = r.read("InvoiceTitle", String.class);
        invoiceInformation = r.read("InvoiceInformation", String.class);
    }
792934
private String buildIncludeRegExp(String[] scanPaths) {
        String includeRegExp = "";
        for (String path : scanPaths) {
            includeRegExp += path.trim().replace("/", "\\.") + ".*|";
        }
        if (scanPaths.length > 0) {
            // Remove last |
            includeRegExp = includeRegExp.substring(0, includeRegExp.length() - 1);
        }
        return includeRegExp;
    }
1142685
public static RateLimiterExports ofSupplier(String prefix, Supplier<Iterable<RateLimiter>> rateLimitersSupplier) {
        return new RateLimiterExports(prefix, rateLimitersSupplier);
    }
743239
@Override
    public void readFragmentFrom(MwsReader r) {
        listOrdersResult = r.read("ListOrdersResult", ListOrdersResult.class);
        responseMetadata = r.read("ResponseMetadata", ResponseMetadata.class);
    }
346992
protected Reader generateResourceForDebug(Reader rd, GeneratorContext context) {

		// Rewrite the image URL
		StringWriter writer = new StringWriter();
		try {
			IOUtils.copy(rd, writer);
			String content = rewriteUrl(context, writer.toString());
			rd = new StringReader(content);
		} catch (IOException e) {
			throw new BundlingProcessException(e);
		}

		return rd;
	}
1168763
private URIReference addCommonTriples(DOReader reader, Set<Triple> set)
            throws ResourceIndexException {

        try {

            URIReference objURI = new SimpleURIReference(
                    new URI(PID.toURI(reader.GetObjectPID())));

            addCoreObjectTriples(reader, objURI, set);

            Datastream[] datastreams = reader.GetDatastreams(null, null);
            for (Datastream ds : datastreams) {
                addCoreDatastreamTriples(ds, objURI, set);
                if (ds.DatastreamID.equals("DC")) {
                    addDCTriples(ds, objURI, set);
                }
            }

            addRelationshipTriples(reader, objURI, set);

            return objURI;
        } catch (ResourceIndexException e) {
            throw e;
        } catch (Exception e) {
            throw new ResourceIndexException("Error generating triples", e);
        }
    }