code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public FilteredView createFilteredView(StaticView view, String key, String description, FilterMode mode, String... tags) {
assertThatTheViewIsNotNull(view);
assertThatTheViewKeyIsSpecifiedAndUnique(key);
FilteredView filteredView = new FilteredView(view, key, description, mode, tags);
f... | java |
View getViewWithKey(String key) {
if (key == null) {
throw new IllegalArgumentException("A key must be specified.");
}
Set<View> views = new HashSet<>();
views.addAll(systemLandscapeViews);
views.addAll(systemContextViews);
views.addAll(containerViews);
... | java |
FilteredView getFilteredViewWithKey(String key) {
if (key == null) {
throw new IllegalArgumentException("A key must be specified.");
}
return filteredViews.stream().filter(v -> key.equals(v.getKey())).findFirst().orElse(null);
} | java |
public String getTags() {
Set<String> setOfTags = getTagsAsSet();
if (setOfTags.isEmpty()) {
return "";
}
StringBuilder buf = new StringBuilder();
for (String tag : setOfTags) {
buf.append(tag);
buf.append(",");
}
String tags... | java |
public void addProperty(String name, String value) {
if (name == null || name.trim().length() == 0) {
throw new IllegalArgumentException("A property name must be specified.");
}
if (value == null || value.trim().length() == 0) {
throw new IllegalArgumentException("A prop... | java |
public Perspective addPerspective(String name, String description) {
if (StringUtils.isNullOrEmpty(name)) {
throw new IllegalArgumentException("A name must be specified.");
}
if (StringUtils.isNullOrEmpty(description)) {
throw new IllegalArgumentException("A description ... | java |
public ContainerInstance add(Container container, boolean replicateContainerRelationships) {
ContainerInstance containerInstance = getModel().addContainerInstance(this, container, replicateContainerRelationships);
this.containerInstances.add(containerInstance);
return containerInstance;
} | java |
public DeploymentNode getDeploymentNodeWithName(String name) {
if (name == null || name.trim().length() == 0) {
throw new IllegalArgumentException("A name must be specified.");
}
for (DeploymentNode deploymentNode : getChildren()) {
if (deploymentNode.getName().equals(na... | java |
public void write(Workspace workspace, Writer writer) {
if (workspace != null && writer != null) {
for (DynamicView view : workspace.getViews().getDynamicViews()) {
write(view, writer);
}
}
} | java |
public void write(Workspace workspace) {
StringWriter stringWriter = new StringWriter();
write(workspace, stringWriter);
System.out.println(stringWriter.toString());
} | java |
public void setLogo(String url) {
if (url != null && url.trim().length() > 0) {
if (Url.isUrl(url) || url.startsWith("data:image/")) {
this.logo = url.trim();
} else {
throw new IllegalArgumentException(url + " is not a valid URL.");
}
... | java |
@Nonnull
public HttpHealthCheck addHealthCheck(String name, String url, int interval, long timeout) {
if (name == null || name.trim().length() == 0) {
throw new IllegalArgumentException("The name must not be null or empty.");
}
if (url == null || url.trim().length() == 0) {
... | java |
public static Workspace loadWorkspaceFromJson(File file) throws Exception {
if (file == null) {
throw new IllegalArgumentException("The path to a JSON file must be specified.");
} else if (!file.exists()) {
throw new IllegalArgumentException("The specified JSON file does not exis... | java |
public static void saveWorkspaceToJson(Workspace workspace, File file) throws Exception {
if (workspace == null) {
throw new IllegalArgumentException("A workspace must be provided.");
} else if (file == null) {
throw new IllegalArgumentException("The path to a JSON file must be s... | java |
public static void printWorkspaceAsJson(Workspace workspace) {
if (workspace == null) {
throw new IllegalArgumentException("A workspace must be provided.");
}
try {
System.out.println(toJson(workspace, true));
} catch (Exception e) {
e.printStackTrace... | java |
public static String toJson(Workspace workspace, boolean indentOutput) throws Exception {
if (workspace == null) {
throw new IllegalArgumentException("A workspace must be provided.");
}
JsonWriter jsonWriter = new JsonWriter(indentOutput);
StringWriter stringWriter = new Str... | java |
public static Workspace fromJson(String json) throws Exception {
if (json == null || json.trim().length() == 0) {
throw new IllegalArgumentException("A JSON string must be provided.");
}
StringReader stringReader = new StringReader(json);
return new JsonReader().read(stringR... | java |
public Set<Component> findComponents() throws Exception {
Set<Component> componentsFound = new HashSet<>();
for (ComponentFinderStrategy componentFinderStrategy : componentFinderStrategies) {
componentFinderStrategy.beforeFindComponents();
}
for (ComponentFinderStrategy com... | java |
public void exclude(String... regexes) {
if (regexes != null) {
for (String regex : regexes) {
this.exclusions.add(Pattern.compile(regex));
}
}
} | java |
public TypeRepository getTypeRepository() {
if (typeRepository == null) {
typeRepository = new DefaultTypeRepository(getPackageNames(), getExclusions(), getUrlClassLoader());
}
return typeRepository;
} | java |
public void setAutomaticLayout(boolean enable) {
if (enable) {
this.setAutomaticLayout(AutomaticLayout.RankDirection.TopBottom, 300, 600, 200, false);
} else {
this.automaticLayout = null;
}
} | java |
public void setAutomaticLayout(AutomaticLayout.RankDirection rankDirection, int rankSeparation, int nodeSeparation, int edgeSeparation, boolean vertices) {
this.automaticLayout = new AutomaticLayout(rankDirection, rankSeparation, nodeSeparation, edgeSeparation, vertices);
} | java |
public void remove(Relationship relationship) {
if (relationship != null) {
RelationshipView relationshipView = new RelationshipView(relationship);
relationshipViews.remove(relationshipView);
}
} | java |
public void removeRelationshipsNotConnectedToElement(Element element) {
if (element != null) {
getRelationships().stream()
.map(RelationshipView::getRelationship)
.filter(r -> !r.getSource().equals(element) && !r.getDestination().equals(element))
... | java |
public void removeElementsWithNoRelationships() {
Set<RelationshipView> relationships = getRelationships();
Set<String> elementIds = new HashSet<>();
relationships.forEach(rv -> elementIds.add(rv.getRelationship().getSourceId()));
relationships.forEach(rv -> elementIds.add(rv.getRelatio... | java |
public DeploymentNode getDeploymentNodeWithName(String name, String environment) {
for (DeploymentNode deploymentNode : getDeploymentNodes()) {
if (deploymentNode.getEnvironment().equals(environment) && deploymentNode.getName().equals(name)) {
return deploymentNode;
}
... | java |
public Element getElementWithCanonicalName(String canonicalName) {
if (canonicalName == null || canonicalName.trim().length() == 0) {
throw new IllegalArgumentException("A canonical name must be specified.");
}
// canonical names start with a leading slash, so add this if it's missi... | java |
public void modifyRelationship(Relationship relationship, String description, String technology) {
if (relationship == null) {
throw new IllegalArgumentException("A relationship must be specified.");
}
Relationship newRelationship = new Relationship(relationship.getSource(), relatio... | java |
public void setUrl(String url) {
if (url != null && url.trim().length() > 0) {
if (Url.isUrl(url)) {
this.url = url;
} else {
throw new IllegalArgumentException(url + " is not a valid URL.");
}
}
} | java |
public Section addSection(String title, File... files) throws IOException {
return add(null, title, files);
} | java |
@Nonnull
public Section addSection(String title, Format format, String content) {
return add(null, title, format, content);
} | java |
public Image addImage(File file) throws IOException {
String contentType = ImageUtils.getContentType(file);
String base64Content = ImageUtils.getImageAsBase64(file);
Image image = new Image(file.getName(), contentType, base64Content);
documentation.addImage(image);
return image... | java |
public void addUser(String username, Role role) {
if (StringUtils.isNullOrEmpty(username)) {
throw new IllegalArgumentException("A username must be specified.");
}
if (role == null) {
throw new IllegalArgumentException("A role must be specified.");
}
use... | java |
public void add(Container container, boolean addRelationships) {
if (container != null && !container.equals(getContainer())) {
addElement(container, addRelationships);
}
} | java |
public void add(Component component, boolean addRelationships) {
if (component != null) {
if (!component.getContainer().equals(getContainer())) {
throw new IllegalArgumentException("Only components belonging to " + container.getName() + " can be added to this view.");
}
... | java |
public void removeElementsThatAreUnreachableFrom(Element element) {
if (element != null) {
Set<Element> elementsToShow = new HashSet<>();
Set<Element> elementsVisited = new HashSet<>();
findElementsToShow(element, element, elementsToShow, elementsVisited);
for (E... | java |
public void addAnimation(Element... elements) {
if (elements == null || elements.length == 0) {
throw new IllegalArgumentException("One or more elements must be specified.");
}
Set<String> elementIdsInPreviousAnimationSteps = new HashSet<>();
Set<Element> elementsInThisAnima... | java |
public void write(Workspace workspace, Writer writer) throws WorkspaceWriterException {
if (workspace == null) {
throw new IllegalArgumentException("Workspace cannot be null.");
}
if (writer == null) {
throw new IllegalArgumentException("Writer cannot be null.");
... | java |
public List<Section> addSections(SoftwareSystem softwareSystem, File directory) throws IOException {
if (softwareSystem == null) {
throw new IllegalArgumentException("A software system must be specified.");
}
return add(softwareSystem, directory);
} | java |
public static TypeVisibility getVisibility(TypeRepository typeRepository, String typeName) {
try {
Class<?> type = typeRepository.loadClass(typeName);
int modifiers = type.getModifiers();
if (Modifier.isPrivate(modifiers)) {
return TypeVisibility.PRIVATE;
... | java |
public static TypeCategory getCategory(TypeRepository typeRepository, String typeName) {
try {
Class<?> type = typeRepository.loadClass(typeName);
if (type.isInterface()) {
return TypeCategory.INTERFACE;
} else if (type.isEnum()) {
return TypeC... | java |
public static Set<Class<?>> findTypesAnnotatedWith(Class<? extends Annotation> annotation, Set<Class<?>> types) {
if (annotation == null) {
throw new IllegalArgumentException("An annotation type must be specified.");
}
return types.stream().filter(c -> c.isAnnotationPresent(annotati... | java |
public static Class findFirstImplementationOfInterface(Class interfaceType, Set<Class<?>> types) {
if (interfaceType == null) {
throw new IllegalArgumentException("An interface type must be provided.");
} else if (!interfaceType.isInterface()) {
throw new IllegalArgumentException... | java |
public void write(Workspace workspace, Writer writer) {
workspace.getViews().getSystemContextViews().forEach(v -> write(v, null, writer));
workspace.getViews().getContainerViews().forEach(v -> write(v, v.getSoftwareSystem(), writer));
workspace.getViews().getComponentViews().forEach(v -> write(v... | java |
public void addHeader(String name, String value) {
if (name == null || name.trim().length() == 0) {
throw new IllegalArgumentException("The header name must not be null or empty.");
}
if (value == null) {
throw new IllegalArgumentException("The header value must not be n... | java |
public static boolean isUrl(String urlAsString) {
if (urlAsString != null && urlAsString.trim().length() > 0) {
try {
new URL(urlAsString);
return true;
} catch (MalformedURLException murle) {
return false;
}
}
... | java |
public Set<Class<?>> findReferencedTypes(String typeName) {
Set<Class<?>> referencedTypes = new HashSet<>();
// use the cached version if possible
if (referencedTypesCache.containsKey(typeName)) {
return referencedTypesCache.get(typeName);
}
try {
CtClas... | java |
public void write(EncryptedWorkspace workspace, Writer writer) throws WorkspaceWriterException {
if (workspace == null) {
throw new IllegalArgumentException("EncryptedWorkspace cannot be null.");
}
if (writer == null) {
throw new IllegalArgumentException("Writer cannot be... | java |
private void checkElement(Element elementToBeAdded) {
if (!(elementToBeAdded instanceof Person) && !(elementToBeAdded instanceof SoftwareSystem) && !(elementToBeAdded instanceof Container) && !(elementToBeAdded instanceof Component)) {
throw new IllegalArgumentException("Only people, software system... | java |
@Override
public int compare(String file0, String file1) {
Matcher m0 = pattern.matcher(file0);
Matcher m1 = pattern.matcher(file1);
if (!m0.matches()) {
Log.w(TAG, "could not parse upgrade script file: " + file0);
throw new SQLiteAssetException("Invalid upgrade scri... | java |
private void init(final Context context, final AttributeSet attrs) {
if (isInEditMode())
return;
final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RippleView);
rippleColor = typedArray.getColor(R.styleable.RippleView_rv_color, getResources().getColor(R.... | java |
private void createAnimation(final float x, final float y) {
if (this.isEnabled() && !animationRunning) {
if (hasToZoom)
this.startAnimation(scaleAnimation);
radiusMax = Math.max(WIDTH, HEIGHT);
if (rippleType != 2)
radiusMax /= 2;
... | java |
private void sendClickEvent(final Boolean isLongClick) {
if (getParent() instanceof AdapterView) {
final AdapterView adapterView = (AdapterView) getParent();
final int position = adapterView.getPositionForView(this);
final long id = adapterView.getItemIdAtPosition(position);
... | java |
public static TypeAdapterFactory create() {
if (geometryTypeFactory == null) {
geometryTypeFactory = RuntimeTypeAdapterFactory.of(Geometry.class, "type", true)
.registerSubtype(GeometryCollection.class, "GeometryCollection")
.registerSubtype(Point.class, "Point")
.registerSubtype(Mult... | java |
public List<LineString> lineStrings() {
List<List<Point>> coordinates = coordinates();
List<LineString> lineStrings = new ArrayList<>(coordinates.size());
for (List<Point> points : coordinates) {
lineStrings.add(LineString.fromLngLats(points));
}
return lineStrings;
} | java |
public static String formatCoordinate(double coordinate) {
DecimalFormat decimalFormat = new DecimalFormat("0.######",
new DecimalFormatSymbols(Locale.US));
return String.format(Locale.US, "%s",
decimalFormat.format(coordinate));
} | java |
public static String formatCoordinate(double coordinate, int precision) {
String pattern = "0." + new String(new char[precision]).replace("\0", "0");
DecimalFormat df = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
df.applyPattern(pattern);
df.setRoundingMode(RoundingMode.FLOOR);
return df.f... | java |
public static String formatRadiuses(double[] radiuses) {
if (radiuses == null || radiuses.length == 0) {
return null;
}
String[] radiusesFormatted = new String[radiuses.length];
for (int i = 0; i < radiuses.length; i++) {
if (radiuses[i] == Double.POSITIVE_INFINITY) {
radiusesFormat... | java |
public static String formatBearing(List<Double[]> bearings) {
if (bearings.isEmpty()) {
return null;
}
String[] bearingFormatted = new String[bearings.size()];
for (int i = 0; i < bearings.size(); i++) {
if (bearings.get(i).length == 0) {
bearingFormatted[i] = "";
} else {
... | java |
public static String formatDistributions(List<Integer[]> distributions) {
if (distributions.isEmpty()) {
return null;
}
String[] distributionsFormatted = new String[distributions.size()];
for (int i = 0; i < distributions.size(); i++) {
if (distributions.get(i).length == 0) {
distri... | java |
public static String formatApproaches(String[] approaches) {
for (int i = 0; i < approaches.length; i++) {
if (approaches[i] == null) {
approaches[i] = "";
} else if (!approaches[i].equals("unrestricted")
&& !approaches[i].equals("curb") && !approaches[i].isEmpty()) {
return null... | java |
public static String formatWaypointNames(String[] waypointNames) {
for (int i = 0; i < waypointNames.length; i++) {
if (waypointNames[i] == null) {
waypointNames[i] = "";
}
}
return TextUtils.join(";", waypointNames);
} | java |
public static Point fromLngLat(
@FloatRange(from = MIN_LONGITUDE, to = MAX_LONGITUDE) double longitude,
@FloatRange(from = MIN_LATITUDE, to = MAX_LATITUDE) double latitude) {
List<Double> coordinates =
CoordinateShifterManager.getCoordinateShifter().shiftLonLat(longitude, latitude);
return new Po... | java |
private static boolean isLinearRing(LineString lineString) {
if (lineString.coordinates().size() < 4) {
throw new GeoJsonException("LinearRings need to be made up of 4 or more coordinates.");
}
if (!(lineString.coordinates().get(0).equals(
lineString.coordinates().get(lineString.coordinates().si... | java |
protected S getService() {
// No need to recreate it
if (service != null) {
return service;
}
Retrofit.Builder retrofitBuilder = new Retrofit.Builder()
.baseUrl(baseUrl())
.addConverterFactory(GsonConverterFactory.create(getGsonBuilder().create()));
if (getCallFactory() != null) ... | java |
protected synchronized OkHttpClient getOkHttpClient() {
if (okHttpClient == null) {
if (isEnableDebug()) {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BASIC);
OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
... | java |
private static String formatWaypointTargets(Point[] waypointTargets) {
String[] coordinatesFormatted = new String[waypointTargets.length];
int index = 0;
for (Point target : waypointTargets) {
if (target == null) {
coordinatesFormatted[index++] = "";
} else {
coordinatesFormatted... | java |
public List<Polygon> polygons() {
List<List<List<Point>>> coordinates = coordinates();
List<Polygon> polygons = new ArrayList<>(coordinates.size());
for (List<List<Point>> points : coordinates) {
polygons.add(Polygon.fromLngLats(points));
}
return polygons;
} | java |
public String toJson() {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create());
gson.registerTypeAdapter(Point.class, new PointAsCoordinatesTypeAdapter());
return gson.create().toJson(this);
} | java |
public HttpUrl url() {
HttpUrl.Builder urlBuilder = HttpUrl.parse(baseUrl()).newBuilder()
.addPathSegment("styles")
.addPathSegment("v1")
.addPathSegment(user())
.addPathSegment(styleId())
.addPathSegment("static")
.addQueryParameter("access_token", accessToken());
List<Stri... | java |
private static void simpleMapboxDirectionsRequest() throws IOException {
MapboxDirections.Builder builder = MapboxDirections.builder();
// 1. Pass in all the required information to get a simple directions route.
builder.accessToken(BuildConfig.MAPBOX_ACCESS_TOKEN);
builder.origin(Point.fromLngLat(-95... | java |
private static void asyncMapboxDirectionsRequest() {
// 1. Pass in all the required information to get a route.
MapboxDirections request = MapboxDirections.builder()
.accessToken(BuildConfig.MAPBOX_ACCESS_TOKEN)
.origin(Point.fromLngLat(-95.6332, 29.7890))
.destination(Point.fromLngLat(-95.35... | java |
public String getStringProperty(String key) {
JsonElement propertyKey = properties().get(key);
return propertyKey == null ? null : propertyKey.getAsString();
} | java |
public Number getNumberProperty(String key) {
JsonElement propertyKey = properties().get(key);
return propertyKey == null ? null : propertyKey.getAsNumber();
} | java |
public Boolean getBooleanProperty(String key) {
JsonElement propertyKey = properties().get(key);
return propertyKey == null ? null : propertyKey.getAsBoolean();
} | java |
public Character getCharacterProperty(String key) {
JsonElement propertyKey = properties().get(key);
return propertyKey == null ? null : propertyKey.getAsCharacter();
} | java |
@Override
public JsonElement serialize(Point src, Type typeOfSrc, JsonSerializationContext context) {
JsonArray rawCoordinates = new JsonArray();
// Unshift coordinates
List<Double> unshiftedCoordinates =
CoordinateShifterManager.getCoordinateShifter().unshiftPoint(src);
rawCoordinates.a... | java |
public static boolean isAccessTokenValid(String accessToken) {
return !TextUtils.isEmpty(accessToken) && !(!accessToken.startsWith("pk.")
&& !accessToken.startsWith("sk.") && !accessToken.startsWith("tk."));
} | java |
public static void geojsonType(GeoJson value, String type, String name) {
if (type == null || type.length() == 0 || name == null || name.length() == 0) {
throw new TurfException("Type and name required");
}
if (value == null || !value.type().equals(type)) {
throw new TurfException("Invalid input... | java |
@Deprecated
public static BoundingBox fromCoordinates(
@FloatRange(from = MIN_LONGITUDE, to = GeoJsonConstants.MAX_LONGITUDE) double west,
@FloatRange(from = MIN_LATITUDE, to = GeoJsonConstants.MAX_LATITUDE) double south,
@FloatRange(from = MIN_LONGITUDE, to = GeoJsonConstants.MAX_LONGITUDE) double east,
... | java |
@NonNull
public static String encode(@NonNull final List<Point> path, int precision) {
long lastLat = 0;
long lastLng = 0;
final StringBuilder result = new StringBuilder();
// OSRM uses precision=6, the default Polyline spec divides by 1E5, capping at precision=5
double factor = Math.pow(10, pre... | java |
private static double getSqDist(Point p1, Point p2) {
double dx = p1.longitude() - p2.longitude();
double dy = p1.latitude() - p2.latitude();
return dx * dx + dy * dy;
} | java |
private static double getSqSegDist(Point point, Point p1, Point p2) {
double horizontal = p1.longitude();
double vertical = p1.latitude();
double diffHorizontal = p2.longitude() - horizontal;
double diffVertical = p2.latitude() - vertical;
if (diffHorizontal != 0 || diffVertical != 0) {
doubl... | java |
private static List<Point> simplifyRadialDist(List<Point> points, double sqTolerance) {
Point prevPoint = points.get(0);
ArrayList<Point> newPoints = new ArrayList<>();
newPoints.add(prevPoint);
Point point = null;
for (int i = 1, len = points.size(); i < len; i++) {
point = points.get(i);
... | java |
private static List<Point> simplifyDouglasPeucker(List<Point> points, double sqTolerance) {
int last = points.size() - 1;
ArrayList<Point> simplified = new ArrayList<>();
simplified.add(points.get(0));
simplified.addAll(simplifyDpStep(points, 0, last, sqTolerance, simplified));
simplified.add(points... | java |
public static double trim(double value) {
if (value > MAX_DOUBLE_TO_ROUND || value < -MAX_DOUBLE_TO_ROUND) {
return value;
}
return Math.round(value * ROUND_PRECISION) / ROUND_PRECISION;
} | java |
public void showHint() {
final int[] screenPos = new int[2];
final Rect displayFrame = new Rect();
getLocationOnScreen(screenPos);
getWindowVisibleDisplayFrame(displayFrame);
final Context context = getContext();
final int width = getWidth();
final int height = getHeight();
final int mid... | java |
View createPickerView() {
View contentView = View.inflate(getActivity(), R.layout.cpv_dialog_color_picker, null);
colorPicker = (ColorPickerView) contentView.findViewById(R.id.cpv_color_picker_view);
ColorPanelView oldColorPanel = (ColorPanelView) contentView.findViewById(R.id.cpv_color_panel_old);
newC... | java |
View createPresetsView() {
View contentView = View.inflate(getActivity(), R.layout.cpv_dialog_presets, null);
shadesLayout = (LinearLayout) contentView.findViewById(R.id.shades_layout);
transparencySeekBar = (SeekBar) contentView.findViewById(R.id.transparency_seekbar);
transparencyPercText = (TextView)... | java |
public void setColor(int color, boolean callback) {
int alpha = Color.alpha(color);
int red = Color.red(color);
int blue = Color.blue(color);
int green = Color.green(color);
float[] hsv = new float[3];
Color.RGBToHSV(red, green, blue, hsv);
this.alpha = alpha;
hue = hsv[0];
sat =... | java |
public void setAlphaSliderVisible(boolean visible) {
if (showAlphaPanel != visible) {
showAlphaPanel = visible;
/*
* Force recreation.
*/
valShader = null;
satShader = null;
alphaShader = null;
hueBackgroundCache = null;
satValBackgroundCache = null;
r... | java |
public static UserAgent valueOf(int id)
{
OperatingSystem operatingSystem = OperatingSystem.valueOf((short) (id >> 16));
Browser browser = Browser.valueOf( (short) (id & 0x0FFFF));
return new UserAgent(operatingSystem,browser);
} | java |
public static UserAgent valueOf(String name)
{
if (name == null)
throw new NullPointerException("Name is null");
String[] elements = name.split("-");
if (elements.length == 2)
{
OperatingSystem operatingSystem = OperatingSystem.valueOf(elements[0]);
Browser browser = Browser.valueOf(ele... | java |
public ByteBuffer reset(ByteBuffer input)
{
ByteBuffer old = this.input;
this.input = checkNotNull(input, "input ByteBuffer is null").slice();
isRead = false;
return old;
} | java |
public MessagePacker packString(String s)
throws IOException
{
if (s.length() <= 0) {
packRawStringHeader(0);
return this;
}
else if (CORRUPTED_CHARSET_ENCODER || s.length() < smallStringOptimizationThreshold) {
// Using String.getBytes is gene... | java |
private static MessageBuffer newMessageBuffer(byte[] arr, int off, int len)
{
checkNotNull(arr);
if (mbArrConstructor != null) {
return newInstance(mbArrConstructor, arr, off, len);
}
return new MessageBuffer(arr, off, len);
} | java |
private static MessageBuffer newMessageBuffer(ByteBuffer bb)
{
checkNotNull(bb);
if (mbBBConstructor != null) {
return newInstance(mbBBConstructor, bb);
}
return new MessageBuffer(bb);
} | java |
private static MessageBuffer newInstance(Constructor<?> constructor, Object... args)
{
try {
// We need to use reflection to create MessageBuffer instances in order to prevent TypeProfile generation for getInt method. TypeProfile will be
// generated to resolve one of the method refe... | java |
public int getInt(int index)
{
// Reading little-endian value
int i = unsafe.getInt(base, address + index);
// Reversing the endian
return Integer.reverseBytes(i);
} | java |
public void putInt(int index, int v)
{
// Reversing the endian
v = Integer.reverseBytes(v);
unsafe.putInt(base, address + index, v);
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.