Existing single CR are not changed to LF but are retained as is.
Optionally, a binary check on the first RawText#getBufferSize() bytes
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 |
|---|---|
| public static class | AutoLFInputStream.
A special exception thrown when |
| public static enum | AutoLFInputStream.
Flags for controlling auto-detection of binary vs. text content (for text=auto). |
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private final byte[] | |
| private int | |
| private boolean | |
| private final boolean | |
| private final InputStream | |
| private boolean | isBinary
Set to |
| private boolean | passAsIs
Set to |
| private int | |
| private final byte[] |
| Access | Constructor and Description |
|---|---|
| public | AutoLFInputStream(InputStream
raw input stream in, Set<AutoLFInputStream.StreamFlags controlling the stream behavior;
null is treated as an empty setCreates a new InputStream, wrapping the specified stream. |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Overrides java. Implements java. Closes this input stream and releases any system resources associated with the stream. |
| public static AutoLFInputStream | Returns: a newAutoLFInputStreamraw input stream in, AutoLFInputStream.StreamFlags controlling the stream behaviorFactory method for creating an |
| private boolean | |
| public boolean | Returns: true if the stream has detected as a binary so far.Whether the stream has detected as a binary so far. |
| public int | read()
Implements abstract java. Reads the next byte of data from the input stream. |
| public int | read(byte[]
the buffer into which the data is read. bs, int the start offset in array off, int b
at which the data is written.the maximum number of bytes to read. len)Overrides java. Reads up to |
| abortIfBinary | back to summary |
|---|---|
| private final boolean abortIfBinary | |
| buf | back to summary |
|---|---|
| private final byte[] buf | |
| cnt | back to summary |
|---|---|
| private int cnt | |
| detectBinary | back to summary |
|---|---|
| private boolean detectBinary | |
| forCheckout | back to summary |
|---|---|
| private final boolean forCheckout | |
| in | back to summary |
|---|---|
| private final InputStream in | |
| isBinary | back to summary |
|---|---|
| private boolean isBinary Set to | |
| passAsIs | back to summary |
|---|---|
| private boolean passAsIs Set to | |
| ptr | back to summary |
|---|---|
| private int ptr | |
| single | back to summary |
|---|---|
| private final byte[] single | |
| AutoLFInputStream | back to summary |
|---|---|
| public AutoLFInputStream(InputStream in, Set<AutoLFInputStream. Creates a new InputStream, wrapping the specified stream.
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Doc from java. Closes this input stream and releases any system resources associated with the stream.
| |
| create | back to summary |
|---|---|
| public static AutoLFInputStream create(InputStream in, AutoLFInputStream. Factory method for creating an
| |
| fillBuffer | back to summary |
|---|---|
| private boolean fillBuffer() throws IOException | |
| isBinary | back to summary |
|---|---|
| public boolean isBinary() Whether the stream has detected as a binary so far.
| |
| read | back to summary |
|---|---|
| public int read() throws IOException Implements abstract java. Doc from java. Reads the next byte of data from the input stream. The value byte is
returned as an
| |
| read | back to summary |
|---|---|
| public int read(byte[] bs, int off, int len) throws IOException Overrides java. Doc from java. Reads up to This method blocks until input data is available, end of file is detected, or an exception is thrown. If The first byte read is stored into element In every case, elements
| |
AutoLFInputStream is told to
throw an exception when attempting to read a binary file. The exception
may be thrown at any stage during reading.
| Modifier and Type | Field and Description |
|---|---|
| private static final long |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| IsBinaryException | back to summary |
|---|---|
| pack-priv IsBinaryException() | |
| Modifier and Type | Field and Description |
|---|---|
| public static final AutoLFInputStream. | ABORT_IF_BINARY
If |
| public static final AutoLFInputStream. | DETECT_BINARY
Check the first 8kB for binary content and switch off canonicalization off for the whole file if so. |
| public static final AutoLFInputStream. | FOR_CHECKOUT
If |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static AutoLFInputStream. | |
| public static AutoLFInputStream. |
| ABORT_IF_BINARY | back to summary |
|---|---|
| public static final AutoLFInputStream. If | |
| DETECT_BINARY | back to summary |
|---|---|
| public static final AutoLFInputStream. Check the first 8kB for binary content and switch off canonicalization off for the whole file if so. | |
| FOR_CHECKOUT | back to summary |
|---|---|
| public static final AutoLFInputStream. If | |
| StreamFlag | back to summary |
|---|---|
| private StreamFlag() | |
| valueOf | back to summary |
|---|---|
| public static AutoLFInputStream. | |
| values | back to summary |
|---|---|
| public static AutoLFInputStream. | |