/** * Copyright 2017 Matt Acosta * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { BomKind } from './BomKind'; import { Encoding } from './Encoding'; import { ISourceText } from './ISourceText'; /** * @todo Document SourceTextFactory. */ export declare class SourceTextFactory { /** * An empty source text container. */ static readonly EmptyText: ISourceText; /** * The maximum length of a string before a more efficient source text * container is created. * * @todo Experimental. * @todo Unused. */ protected static readonly LargeTextLimit: number; /** * Creates a source text object from a string. * * @param {string} text * A string containing source code. * @param {Encoding=} encoding * The original encoding of the source text. Defaults to `Encoding.Utf8`. */ static from(text: string, encoding?: Encoding): ISourceText; /** * Attempts to determine if a byte order mark is present in the source text. * * @param {Uint8Array} buffer * A byte-array containing the encoded source text. * @param {number} length * The number of valid bytes in the buffer. */ static tryReadByteOrderMark(buffer: Uint8Array, length: number): BomKind; }