|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jgit.transport.PacketLineOut
public class PacketLineOut
Write Git style pkt-line formatting to an output stream.
This class is not thread safe and may issue multiple writes to the underlying stream for each method call made.
This class performs no buffering on its own. This makes it suitable to interleave writes performed by this class with writes performed directly against the underlying OutputStream.
Constructor Summary | |
---|---|
PacketLineOut(OutputStream outputStream)
Create a new packet line writer. |
Method Summary | |
---|---|
void |
end()
Write a packet end marker, sometimes referred to as a flush command. |
void |
flush()
Flush the underlying OutputStream. |
void |
setFlushOnEnd(boolean flushOnEnd)
Set the flush behavior during end() . |
void |
writePacket(byte[] packet)
Write a binary packet to the stream. |
void |
writeString(String s)
Write a UTF-8 encoded string as a single length-delimited packet. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PacketLineOut(OutputStream outputStream)
outputStream
- stream.Method Detail |
---|
public void setFlushOnEnd(boolean flushOnEnd)
end()
.
flushOnEnd
- if true, a flush-pkt written during end()
also
flushes the underlying stream.public void writeString(String s) throws IOException
s
- string to write.
IOException
- the packet could not be written, the stream is corrupted as
the packet may have been only partially written.public void writePacket(byte[] packet) throws IOException
packet
- the packet to write; the length of the packet is equal to the
size of the byte array.
IOException
- the packet could not be written, the stream is corrupted as
the packet may have been only partially written.public void end() throws IOException
Technically this is a magical packet type which can be detected separately from an empty string or an empty packet.
Implicitly performs a flush on the underlying OutputStream to ensure the peer will receive all data written thus far.
IOException
- the end marker could not be written, the stream is corrupted
as the end marker may have been only partially written.public void flush() throws IOException
Performs a flush on the underlying OutputStream to ensure the peer will receive all data written thus far.
IOException
- the underlying stream failed to flush.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |