public class AutoLFInputStream extends InputStream
Existing single CR are not changed to LF but are retained as is.
Optionally, a binary check on the first 8kB is performed and in case of binary files, canonicalization is turned off (for the complete file). If binary checking determines that the input is CR/LF-delimited text and the stream has been created for checkout, canonicalization is also turned off.
Modifier and Type | Class and Description |
---|---|
static class |
AutoLFInputStream.IsBinaryException
A special exception thrown when
AutoLFInputStream is told to
throw an exception when attempting to read a binary file. |
static class |
AutoLFInputStream.StreamFlag
Flags for controlling auto-detection of binary vs.
|
Constructor and Description |
---|
AutoLFInputStream(InputStream in,
boolean detectBinary)
Deprecated.
since 5.9, use
create(InputStream, StreamFlag...)
instead |
AutoLFInputStream(InputStream in,
boolean detectBinary,
boolean abortIfBinary)
Deprecated.
since 5.9, use
create(InputStream, StreamFlag...)
instead |
AutoLFInputStream(InputStream in,
Set<AutoLFInputStream.StreamFlag> flags)
Creates a new InputStream, wrapping the specified stream.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
static AutoLFInputStream |
create(InputStream in,
AutoLFInputStream.StreamFlag... flags)
Factory method for creating an
AutoLFInputStream with the
specified flags . |
boolean |
isBinary()
Whether the stream has detected as a binary so far.
|
int |
read() |
int |
read(byte[] bs,
int off,
int len) |
available, mark, markSupported, read, reset, skip
public AutoLFInputStream(InputStream in, Set<AutoLFInputStream.StreamFlag> flags)
in
- raw input streamflags
- AutoLFInputStream.StreamFlag
s controlling the stream behavior;
null
is treated as an empty set@Deprecated public AutoLFInputStream(InputStream in, boolean detectBinary)
create(InputStream, StreamFlag...)
insteadin
- raw input streamdetectBinary
- whether binaries should be detected@Deprecated public AutoLFInputStream(InputStream in, boolean detectBinary, boolean abortIfBinary)
create(InputStream, StreamFlag...)
insteadin
- raw input streamdetectBinary
- whether binaries should be detectedabortIfBinary
- throw an IOException if the file is binarypublic static AutoLFInputStream create(InputStream in, AutoLFInputStream.StreamFlag... flags)
AutoLFInputStream
with the
specified flags
.in
- raw input streamflags
- AutoLFInputStream.StreamFlag
s controlling the stream behaviorAutoLFInputStream
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] bs, int off, int len) throws IOException
read
in class InputStream
IOException
public boolean isBinary()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
Copyright © 2021 Eclipse JGit Project. All rights reserved.