blob: c6032e751b7a25e923f724665e2a24490158b410 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.text;
/**
* This wraps a window in a backing byte array. Without doing any copying.
* @author <a href="mailto:balder@yahoo-inc.com">Henning Baldersheim</a>
* @since 5.2
*/
public class Utf8PartialArray extends Utf8Array {
final int offset;
final int length;
/**
* Takes ownership of the given byte array. And keeps note of where
* the interesting utf8 sequence start and its length.
* @param utf8data The backing byte array.
* @param offset The start of the utf8 sequence.
* @param bytes The length of the utf8 sequence.
*/
public Utf8PartialArray(byte[] utf8data, int offset, int bytes) {
super(utf8data);
this.offset = offset;
this.length = bytes;
}
@Override
public int getByteLength() {
return length;
}
@Override
protected int getByteOffset() {
return offset;
}
}
|