Java Code Examples for io.netty.buffer.ByteBufInputStream#readLong()
The following examples show how to use
io.netty.buffer.ByteBufInputStream#readLong() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WireCommands.java From pravega with Apache License 2.0 | 6 votes |
public static WireCommand readFrom(ByteBufInputStream in, int length) throws IOException { long requestId = in.readLong(); String segment = in.readUTF(); String delegationToken = in.readUTF(); int suggestedEntryCount = in.readInt(); int dataLength = in.readInt(); if (length < dataLength + Long.BYTES + segment.getBytes(UTF_8).length + delegationToken.getBytes(UTF_8).length + 2 * Integer.BYTES ) { throw new InvalidMessageException("Was expecting length: " + length + " but found: " + dataLength); } byte[] continuationToken = new byte[dataLength]; in.readFully(continuationToken); return new ReadTableEntries(requestId, segment, delegationToken, suggestedEntryCount, wrappedBuffer(continuationToken)); }
Example 2
Source File: WireCommands.java From pravega with Apache License 2.0 | 5 votes |
public static WireCommand readFrom(ByteBufInputStream in, int length) throws IOException { long requestId = in.readLong(); String segment = in.readUTF(); String serverStackTrace = (in.available() > 0) ? in.readUTF() : EMPTY_STACK_TRACE; long offset = (in.available() >= Long.BYTES) ? in.readLong() : -1L; return new SegmentIsSealed(requestId, segment, serverStackTrace, offset); }
Example 3
Source File: WireCommands.java From pravega with Apache License 2.0 | 5 votes |
public static WireCommand readFrom(ByteBufInputStream in, int length) throws IOException { long requestId = in.readLong(); String segment = in.readUTF(); String delegationToken = in.readUTF(); long fromVersion = in.readLong(); int suggestedEntryCount = in.readInt(); return new ReadTableEntriesDelta(requestId, segment, delegationToken, fromVersion, suggestedEntryCount); }
Example 4
Source File: WireCommands.java From pravega with Apache License 2.0 | 5 votes |
public static WireCommand readFrom(ByteBufInputStream in, int length) throws IOException { long requestId = in.readLong(); String segment = in.readUTF(); String delegationToken = in.readUTF(); int suggestedKeyCount = in.readInt(); int dataLength = in.readInt(); if (length < dataLength + Long.BYTES + segment.getBytes(UTF_8).length + delegationToken.getBytes(UTF_8).length + 2 * Integer.BYTES) { throw new InvalidMessageException("Was expecting length: " + length + " but found: " + dataLength); } byte[] continuationToken = new byte[dataLength]; in.readFully(continuationToken); return new ReadTableKeys(requestId, segment, delegationToken, suggestedKeyCount, wrappedBuffer(continuationToken)); }
Example 5
Source File: WireCommands.java From pravega with Apache License 2.0 | 5 votes |
public static WireCommand readFrom(ByteBufInputStream in, int length) throws IOException { long requestId = in.readLong(); String serverStackTrace = (in.available() > 0) ? in.readUTF() : EMPTY_STACK_TRACE; // errorCode is a new field and wasn't present earlier. Doing this to allow it to work with older clients. int errorCode = in.available() >= Integer.BYTES ? in.readInt() : -1; return new AuthTokenCheckFailed(requestId, serverStackTrace, ErrorCode.valueOf(errorCode)); }
Example 6
Source File: WireCommands.java From pravega with Apache License 2.0 | 5 votes |
public static WireCommand readFrom(ByteBufInputStream in, int length) throws IOException { long requestId = in.readLong(); String target = in.readUTF(); String source = in.readUTF(); long newTargetWriteOffset = in.available() > 0 ? in.readLong() : -1; return new SegmentsMerged(requestId, target, source, newTargetWriteOffset); }
Example 7
Source File: WireCommands.java From pravega with Apache License 2.0 | 5 votes |
public static WireCommand readFrom(ByteBufInputStream in, int length) throws IOException { String segment = in.readUTF(); long offset = in.readLong(); int suggestedLength = in.readInt(); String delegationToken = in.readUTF(); long requestId = in.available() >= Long.BYTES ? in.readLong() : -1L; return new ReadSegment(segment, offset, suggestedLength, delegationToken, requestId); }
Example 8
Source File: WireCommands.java From pravega with Apache License 2.0 | 5 votes |
public static WireCommand readFrom(ByteBufInputStream in, int length) throws IOException { UUID writerId = new UUID(in.readLong(), in.readLong()); long eventNumber = in.readLong(); long previousEventNumber = in.available() >= Long.BYTES ? in.readLong() : -1L; long requestId = in.available() >= Long.BYTES ? in.readLong() : -1L; long currentSegmentWriteOffset = in.available() >= Long.BYTES ? in.readLong() : -1L; return new DataAppended(requestId, writerId, eventNumber, previousEventNumber, currentSegmentWriteOffset); }
Example 9
Source File: WireCommands.java From pravega with Apache License 2.0 | 5 votes |
public static WireCommand readFrom(ByteBufInputStream in, int length) throws IOException { long requestId = in.readLong(); String segment = in.readUTF(); String serverStackTrace = (in.available() > 0) ? in.readUTF() : EMPTY_STACK_TRACE; long offset = (in.available() >= Long.BYTES) ? in.readLong() : -1L; return new NoSuchSegment(requestId, segment, serverStackTrace, offset); }
Example 10
Source File: WireCommands.java From pravega with Apache License 2.0 | 5 votes |
public static WireCommand readFrom(ByteBufInputStream in, int length) throws IOException { long requestId = in.readLong(); String segment = in.readUTF(); long startOffset = in.readLong(); String serverStackTrace = (in.available() > 0) ? in.readUTF() : EMPTY_STACK_TRACE; long offset = (in.available() >= Long.BYTES) ? in.readLong() : -1L; return new SegmentIsTruncated(requestId, segment, startOffset, serverStackTrace, offset); }
Example 11
Source File: WireCommands.java From pravega with Apache License 2.0 | 5 votes |
public static WireCommand readFrom(ByteBufInputStream in, int length) throws IOException { long requestId = in.readLong(); String segment = in.readUTF(); String correctHost = in.readUTF(); String serverStackTrace = (in.available() > 0) ? in.readUTF() : EMPTY_STACK_TRACE; return new WrongHost(requestId, segment, correctHost, serverStackTrace); }
Example 12
Source File: WireCommands.java From pravega with Apache License 2.0 | 4 votes |
public static WireCommand readFrom(ByteBufInputStream in, int length) throws IOException { long requestId = in.readLong(); String operationName = in.readUTF(); String serverStackTrace = (in.available() > 0) ? in.readUTF() : EMPTY_STACK_TRACE; return new OperationUnsupported(requestId, operationName, serverStackTrace); }
Example 13
Source File: WireCommands.java From pravega with Apache License 2.0 | 4 votes |
public static WireCommand readFrom(ByteBufInputStream in, int length) throws IOException { UUID writerId = new UUID(in.readLong(), in.readLong()); long offset = in.readLong(); long requestId = in.available() >= Long.BYTES ? in.readLong() : -1L; return new ConditionalCheckFailed(writerId, offset, requestId); }
Example 14
Source File: WireCommands.java From pravega with Apache License 2.0 | 4 votes |
public static WireCommand readFrom(ByteBufInputStream in, int length) throws IOException { UUID writerId = new UUID(in.readLong(), in.readLong()); long eventNumber = in.readLong(); String serverStackTrace = (in.available() > 0) ? in.readUTF() : EMPTY_STACK_TRACE; return new InvalidEventNumber(writerId, eventNumber, serverStackTrace); }
Example 15
Source File: WireCommands.java From pravega with Apache License 2.0 | 4 votes |
public static WireCommand readFrom(ByteBufInputStream in, int length) throws IOException { long requestId = in.readLong(); String segment = in.readUTF(); String serverStackTrace = in.readUTF(); return new TableSegmentNotEmpty(requestId, segment, serverStackTrace); }
Example 16
Source File: WireCommands.java From pravega with Apache License 2.0 | 4 votes |
public static WireCommand readFrom(ByteBufInputStream in, int length) throws IOException { long requestId = in.readLong(); String segment = in.readUTF(); String serverStackTrace = (in.available() > 0) ? in.readUTF() : EMPTY_STACK_TRACE; return new SegmentAlreadyExists(requestId, segment, serverStackTrace); }
Example 17
Source File: WireCommands.java From pravega with Apache License 2.0 | 4 votes |
public static WireCommand readFrom(ByteBufInputStream in, int length) throws IOException { long requestId = in.readLong(); String segment = in.readUTF(); String serverStackTrace = in.readUTF(); return new TableKeyDoesNotExist(requestId, segment, serverStackTrace); }
Example 18
Source File: WireCommands.java From pravega with Apache License 2.0 | 4 votes |
public static WireCommand readFrom(ByteBufInputStream in, int length) throws IOException { long requestId = in.readLong(); String segment = in.readUTF(); String serverStackTrace = in.readUTF(); return new TableKeyBadVersion(requestId, segment, serverStackTrace); }