C# 클래스 NGit.Diff.RawText

A Sequence supporting UNIX formatted text in byte[] format.
A Sequence supporting UNIX formatted text in byte[] format.

Elements of the sequence are the lines of the file, as delimited by the UNIX newline character ('\n'). The file content is treated as 8 bit binary text, with no assumptions or requirements on character encoding.

Note that the first line of the file is element 0, as defined by the Sequence interface API. Traditionally in a text editor a patch file the first line is line number 1. Callers may need to subtract 1 prior to invoking methods if they are converting from "line number" to "element index".

상속: NGit.Diff.Sequence
파일 보기 프로젝트 열기: red-gate/ngit 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
EMPTY_TEXT RawText

보호된 프로퍼티들

프로퍼티 타입 설명
content byte[]
lines NGit.Util.IntList

공개 메소드들

메소드 설명
GetLineDelimiter ( ) : string

Get the line delimiter for the first line.

Get the line delimiter for the first line.

GetString ( int i ) : string

Get the text for a single line.

Get the text for a single line.

GetString ( int begin, int end, bool dropLF ) : string

Get the text for a region of lines.

Get the text for a region of lines.

IsBinary ( InputStream raw ) : bool

Determine heuristically whether the bytes contained in a stream represents binary (as opposed to text) content.

Determine heuristically whether the bytes contained in a stream represents binary (as opposed to text) content. Note: Do not further use this stream after having called this method! The stream may not be fully read and will be left at an unknown position after consuming an unknown number of bytes. The caller is responsible for closing the stream.

IsBinary ( byte raw ) : bool

Determine heuristically whether a byte array represents binary (as opposed to text) content.

Determine heuristically whether a byte array represents binary (as opposed to text) content.

IsBinary ( byte raw, int length ) : bool

Determine heuristically whether a byte array represents binary (as opposed to text) content.

Determine heuristically whether a byte array represents binary (as opposed to text) content.

IsMissingNewlineAtEnd ( ) : bool

Determine if the file ends with a LF ('\n').

Determine if the file ends with a LF ('\n').

RawText ( FilePath file ) : NGit.Diff

Create a new sequence from a file.

Create a new sequence from a file.

The entire file contents are used.

RawText ( byte input ) : NGit.Diff

Create a new sequence from an existing content byte array.

Create a new sequence from an existing content byte array.

The entire array (indexes 0 through length-1) is used as the content.

Size ( ) : int
WriteLine ( OutputStream @out, int i ) : void

Write a specific line to the output stream, without its trailing LF.

Write a specific line to the output stream, without its trailing LF.

The specified line is copied as-is, with no character encoding translation performed.

If the specified line ends with an LF ('\n'), the LF is not copied. It is up to the caller to write the LF, if desired, between output lines.

보호된 메소드들

메소드 설명
Decode ( int start, int end ) : string

Decode a region of the text into a String.

Decode a region of the text into a String. The default implementation of this method tries to guess the character set by considering UTF-8, the platform default, and falling back on ISO-8859-1 if neither of those can correctly decode the region given.

비공개 메소드들

메소드 설명
GetEnd ( int i ) : int
GetStart ( int i ) : int

메소드 상세

Decode() 보호된 메소드

Decode a region of the text into a String.
Decode a region of the text into a String. The default implementation of this method tries to guess the character set by considering UTF-8, the platform default, and falling back on ISO-8859-1 if neither of those can correctly decode the region given.
protected Decode ( int start, int end ) : string
start int first byte of the content to decode.
end int one past the last byte of the content to decode.
리턴 string

GetLineDelimiter() 공개 메소드

Get the line delimiter for the first line.
Get the line delimiter for the first line.
public GetLineDelimiter ( ) : string
리턴 string

GetString() 공개 메소드

Get the text for a single line.
Get the text for a single line.
public GetString ( int i ) : string
i int /// index of the line to extract. Note this is 0-based, so line /// number 1 is actually index 0. ///
리턴 string

GetString() 공개 메소드

Get the text for a region of lines.
Get the text for a region of lines.
public GetString ( int begin, int end, bool dropLF ) : string
begin int /// index of the first line to extract. Note this is 0-based, so /// line number 1 is actually index 0. ///
end int index of one past the last line to extract.
dropLF bool /// if true the trailing CRLF or LF ('\n' or '\r\n') of the last returned line is /// dropped, if present. ///
리턴 string

IsBinary() 공개 정적인 메소드

Determine heuristically whether the bytes contained in a stream represents binary (as opposed to text) content.
Determine heuristically whether the bytes contained in a stream represents binary (as opposed to text) content. Note: Do not further use this stream after having called this method! The stream may not be fully read and will be left at an unknown position after consuming an unknown number of bytes. The caller is responsible for closing the stream.
if input stream could not be read
public static IsBinary ( InputStream raw ) : bool
raw Sharpen.InputStream input stream containing the raw file content.
리턴 bool

IsBinary() 공개 정적인 메소드

Determine heuristically whether a byte array represents binary (as opposed to text) content.
Determine heuristically whether a byte array represents binary (as opposed to text) content.
public static IsBinary ( byte raw ) : bool
raw byte the raw file content.
리턴 bool

IsBinary() 공개 정적인 메소드

Determine heuristically whether a byte array represents binary (as opposed to text) content.
Determine heuristically whether a byte array represents binary (as opposed to text) content.
public static IsBinary ( byte raw, int length ) : bool
raw byte the raw file content.
length int /// number of bytes in /// raw /// to evaluate. This should be /// raw.length /// unless /// raw /// was over-allocated by /// the caller. ///
리턴 bool

IsMissingNewlineAtEnd() 공개 메소드

Determine if the file ends with a LF ('\n').
Determine if the file ends with a LF ('\n').
public IsMissingNewlineAtEnd ( ) : bool
리턴 bool

RawText() 공개 메소드

Create a new sequence from a file.
Create a new sequence from a file.

The entire file contents are used.

if Exceptions occur while reading the file ///
public RawText ( FilePath file ) : NGit.Diff
file Sharpen.FilePath the text file.
리턴 NGit.Diff

RawText() 공개 메소드

Create a new sequence from an existing content byte array.
Create a new sequence from an existing content byte array.

The entire array (indexes 0 through length-1) is used as the content.

public RawText ( byte input ) : NGit.Diff
input byte /// the content array. The array is never modified, so passing /// through cached arrays is safe. ///
리턴 NGit.Diff

Size() 공개 메소드

public Size ( ) : int
리턴 int

WriteLine() 공개 메소드

Write a specific line to the output stream, without its trailing LF.
Write a specific line to the output stream, without its trailing LF.

The specified line is copied as-is, with no character encoding translation performed.

If the specified line ends with an LF ('\n'), the LF is not copied. It is up to the caller to write the LF, if desired, between output lines.

the stream write operation failed.
public WriteLine ( OutputStream @out, int i ) : void
@out Sharpen.OutputStream
i int /// index of the line to extract. Note this is 0-based, so line /// number 1 is actually index 0. ///
리턴 void

프로퍼티 상세

EMPTY_TEXT 공개적으로 정적으로 프로퍼티

A Rawtext of length 0
public static RawText,NGit.Diff EMPTY_TEXT
리턴 RawText

content 보호되어 있는 프로퍼티

The file content for this sequence.
The file content for this sequence.
protected byte[] content
리턴 byte[]

lines 보호되어 있는 프로퍼티

Map of line number to starting position within content .
protected IntList,NGit.Util lines
리턴 NGit.Util.IntList