public class PacketLineIn extends Object
This class is not thread safe and may issue multiple reads to the underlying stream for each method call made.
This class performs no buffering on its own. This makes it suitable to interleave reads performed by this class with reads performed directly against the underlying InputStream.
Modifier and Type | Field and Description |
---|---|
static String |
END
Magic return from
readString() when a flush packet is found. |
Constructor and Description |
---|
PacketLineIn(InputStream i)
Create a new packet line reader.
|
Modifier and Type | Method and Description |
---|---|
String |
readString()
Read a single UTF-8 encoded string packet from the input stream.
|
String |
readStringRaw()
Read a single UTF-8 encoded string packet from the input stream.
|
public static final String END
readString()
when a flush packet is found.public PacketLineIn(InputStream i)
i
- the input stream to consume.public String readString() throws IOException
If the string ends with an LF, it will be removed before returning the
value to the caller. If this automatic trimming behavior is not desired,
use readStringRaw()
instead.
END
if the string was the magic flush
packet.IOException
- the stream cannot be read.public String readStringRaw() throws IOException
Unlike readString()
a trailing LF will be retained.
END
if the string was the magic flush
packet.IOException
- the stream cannot be read.Copyright © 2015 Eclipse JGit Project. All rights reserved.