id
stringlengths
7
14
text
stringlengths
1
106k
206350_74
public static byte[] encodeBase64Chunked(byte[] binaryData) { return encodeBase64(binaryData, true); }
206350_75
public static byte[] decodeBase64(byte[] base64Data) { // RFC 2045 requires that we discard ALL non-Base64 characters base64Data = discardNonBase64(base64Data); // handle the edge case, so we don't have to worry about it later if (base64Data.length == 0) { return new byte[0]; } int numbe...
206350_76
public static byte[] decodeBase64(byte[] base64Data) { // RFC 2045 requires that we discard ALL non-Base64 characters base64Data = discardNonBase64(base64Data); // handle the edge case, so we don't have to worry about it later if (base64Data.length == 0) { return new byte[0]; } int numbe...
206350_77
static byte[] discardWhitespace(byte[] data) { byte groomedData[] = new byte[data.length]; int bytesCopied = 0; for (byte datum : data) { switch (datum) { case (byte) ' ': case (byte) '\n': case (byte) '\r': case (byte) '\t': break; ...
206350_78
@Override public EventBridge createEventBridge( Collection<EventSubject> localSubjects, String externalSubject, Map<String, String> properties) { return new XMPPBridge(localSubjects, externalSubject, properties); }
206350_79
@Override public EventBridge createEventBridge( Collection<EventSubject> localSubjects, String externalSubject, Map<String, String> properties) { return new XMPPBridge(localSubjects, externalSubject, properties); }
206350_80
public void relate(DataObject from, DataObject to) { if (from.getObjectContext() == null) { throw new IllegalArgumentException("'from' has null ObjectContext"); } String property = objectIdPropertyName(from); String relationship = objectIdRelationshipName(property); if (to != null) { ...
206350_81
public void relate(DataObject from, DataObject to) { if (from.getObjectContext() == null) { throw new IllegalArgumentException("'from' has null ObjectContext"); } String property = objectIdPropertyName(from); String relationship = objectIdRelationshipName(property); if (to != null) { ...
206350_82
public void relate(DataObject from, DataObject to) { if (from.getObjectContext() == null) { throw new IllegalArgumentException("'from' has null ObjectContext"); } String property = objectIdPropertyName(from); String relationship = objectIdRelationshipName(property); if (to != null) { ...
206350_83
public String getStringId(ObjectId id) { EntityIdCoder coder = getCoder(id.getEntityName()); return coder.toStringId(id); }
206350_84
public String getStringId(ObjectId id) { EntityIdCoder coder = getCoder(id.getEntityName()); return coder.toStringId(id); }
206350_85
public String getStringId(ObjectId id) { EntityIdCoder coder = getCoder(id.getEntityName()); return coder.toStringId(id); }
206350_86
public ObjectId getObjectId(String id) { String entityName = EntityIdCoder.getEntityName(id); EntityIdCoder coder = getCoder(entityName); return coder.toObjectId(id); }
206350_87
public String getStringId(ObjectId id) { EntityIdCoder coder = getCoder(id.getEntityName()); return coder.toStringId(id); }
206350_88
public Collection<String> getStringIds() { return stringIds; }
206350_89
public static String getEntityName(String id) { int separator = id.indexOf(ID_SEPARATOR); if (separator <= 0 || separator == id.length() - 1) { throw new IllegalArgumentException("Invalid String id: " + id); } String name = id.substring(0, separator); if (name.startsWith(TEMP_ID_PREFIX)) { ...
206350_90
public String pluralize(String str) { if (str == null || str.length() == 0) { return str; } else if (str.endsWith("s") || str.endsWith("x")) { return str + "es"; } else if (str.endsWith("y")) { return str.substring(0, str.length() - 1) + "ies"; } else { return...
206350_91
public String capitalizedAsConstant(String name) { if (name == null || name.length() == 0) { return name; } // clear of non-java chars. While the method name implies that a passed identifier // is pure Java, it is used to build pk columns names and such, so extra safety // check is a good id...
206350_92
public String capitalizedAsConstant(String name) { if (name == null || name.length() == 0) { return name; } // clear of non-java chars. While the method name implies that a passed identifier // is pure Java, it is used to build pk columns names and such, so extra safety // check is a good id...
206350_93
public String capitalizedAsConstant(String name) { if (name == null || name.length() == 0) { return name; } // clear of non-java chars. While the method name implies that a passed identifier // is pure Java, it is used to build pk columns names and such, so extra safety // check is a good id...
206350_94
public String capitalizedAsConstant(String name) { if (name == null || name.length() == 0) { return name; } // clear of non-java chars. While the method name implies that a passed identifier // is pure Java, it is used to build pk columns names and such, so extra safety // check is a good id...
206350_95
public String capitalizedAsConstant(String name) { if (name == null || name.length() == 0) { return name; } // clear of non-java chars. While the method name implies that a passed identifier // is pure Java, it is used to build pk columns names and such, so extra safety // check is a good id...
206350_96
public String capitalizedAsConstant(String name) { if (name == null || name.length() == 0) { return name; } // clear of non-java chars. While the method name implies that a passed identifier // is pure Java, it is used to build pk columns names and such, so extra safety // check is a good id...
206350_97
public String capitalizedAsConstant(String name) { if (name == null || name.length() == 0) { return name; } // clear of non-java chars. While the method name implies that a passed identifier // is pure Java, it is used to build pk columns names and such, so extra safety // check is a good id...
206350_98
public String capitalizedAsConstant(String name) { if (name == null || name.length() == 0) { return name; } // clear of non-java chars. While the method name implies that a passed identifier // is pure Java, it is used to build pk columns names and such, so extra safety // check is a good id...
206350_99
public String stripGeneric(String str) { if(str == null) { return null; } int start = str.indexOf('<'); if(start == -1) { return str; } int end = str.lastIndexOf('>'); if(end == -1) { return str; } else if(end == str.length() - 1) { return str.substring(0,...
206364_10
public static String trimToNull(String str) { if (str == null || str.isEmpty()) { return null; } str = str.trim(); if (str.isEmpty()) { return null; } return str; }
206364_11
public static String capitalize(final String str) { int strLen; if (str == null || (strLen = str.length()) == 0) { return str; } final char firstChar = str.charAt(0); if (Character.isTitleCase(firstChar)) { // already capitalized return str; } return new StringBuilder...
206364_12
public static boolean endsWithIgnoreCase(String str, String suffix) { if (str == null || suffix == null) { return str == null && suffix == null; } int strlen = str.length(); if (suffix.length() > strlen) { return false; } return str.substring(str.length() - suffix.length(), strle...
206364_13
public static <T> T parse(String val, Class<T> type) { if (type == null) { throw new NullPointerException("target type must not be null"); } // handle primitives if (type == byte.class) { return (T) (val == null ? BYTE_ZERO : Byte.valueOf(val)); } if (type == char.class) { ...
206364_14
public static String join(Object[] values, String joinToken) { if (values == null) { return null; } if (values.length == 0) { return ""; } if (values.length == 1) { return values[0].toString(); } if (joinToken == null) { joinToken = "null"; // backward compat ...
206364_15
public static String[] split(String str, String token, int max) { if (str == null || str.length() == 0) { return EMPTY_STRING_ARRAY; } if (token == null || token.length() == 0) { throw new IllegalArgumentException("token: [" + token + "]"); } // split on token List<String> ret = ...
206364_16
public static String replace(String str, String from, String to) { if (from.equals(to)) { return str; } String[] split = split(str, from, Integer.MAX_VALUE); return join(split, to); }
206364_17
public static String join(Object[] values, String joinToken) { if (values == null) { return null; } if (values.length == 0) { return ""; } if (values.length == 1) { return values[0].toString(); } if (joinToken == null) { joinToken = "null"; // backward compat ...
206364_18
public TemporaryClassLoader(ClassLoader parent) { super(parent); }
206364_19
public Options setInto(Object obj) { // set all defaults that have no explicit value Map.Entry entry = null; if (defaults != null) { for (Iterator<?> itr = defaults.entrySet().iterator(); itr.hasNext();) { entry = (Map.Entry) itr.next(); if (!containsKey(entry.getKey())) ...
206364_20
public boolean addClassLoader(ClassLoader loader) { if (_loaders.contains(loader)) return false; return _loaders.add(loader); }
206364_21
public Message get(String key) { return get(key, null); }
206364_22
public Message get(String key) { return get(key, null); }
206364_23
public static Class toClass(String str, ClassLoader loader) { return toClass(str, false, loader); }
206364_24
public static Class toClass(String str, ClassLoader loader) { return toClass(str, false, loader); }
206364_25
public static String getClassName(Class cls) { if (cls == null) { return null; } return getClassName(cls.getName()); }
206364_26
public static String getClassName(Class cls) { if (cls == null) { return null; } return getClassName(cls.getName()); }
206364_27
public static String getPackageName(Class cls) { return (cls == null) ? null : getPackageName(cls.getName()); }
206364_28
public Collection<Edge> getEdges(int type) { Collection<Edge> typed = null; for (Object node : _graph.getNodes()) { for (Edge edge : _graph.getEdgesFrom(node)) { if (edge.getType() == type) { if (typed == null) typed = new ArrayList<>(); ty...
206364_29
public Collection<Edge> getEdges(int type) { Collection<Edge> typed = null; for (Object node : _graph.getNodes()) { for (Edge edge : _graph.getEdgesFrom(node)) { if (edge.getType() == type) { if (typed == null) typed = new ArrayList<>(); ty...
206364_30
public Collection<Edge> getEdges(int type) { Collection<Edge> typed = null; for (Object node : _graph.getNodes()) { for (Edge edge : _graph.getEdgesFrom(node)) { if (edge.getType() == type) { if (typed == null) typed = new ArrayList<>(); ty...
206364_31
public static Options parseProperties(String properties) { Options opts = new Options(); properties = StringUtil.trimToNull(properties); if (properties == null) return opts; try { String[] props = StringUtil.split(properties, ",", 0); int idx; char quote; String p...
206364_32
public static String combinePlugins(String orig, String override) { if (StringUtil.isEmpty(orig)) return override; if (StringUtil.isEmpty(override)) return orig; String origCls = getClassName(orig); String overrideCls = getClassName(override); String cls; if (StringUtil.isEmpty(o...
206364_33
@Override public List getAnchorsInResource(String resource) throws Exception { ConfigurationParser parser = new ConfigurationParser(null); try { List results = new ArrayList(); ClassLoader loader = AccessController.doPrivileged( J2DoPrivHelper.getContextClassLoaderAction()); Lis...
206364_34
public ConfigurationProvider load(PersistenceUnitInfo pinfo, Map m) throws IOException { if (pinfo == null) return null; if (!isOpenJPAPersistenceProvider(pinfo, null)) { warnUnknownProvider(pinfo); return null; } ConfigurationProviderImpl cp = new ConfigurationProviderImpl()...
206364_35
public ConfigurationProvider load(PersistenceUnitInfo pinfo, Map m) throws IOException { if (pinfo == null) return null; if (!isOpenJPAPersistenceProvider(pinfo, null)) { warnUnknownProvider(pinfo); return null; } ConfigurationProviderImpl cp = new ConfigurationProviderImpl()...
206364_36
static String dictionaryClassForString(String prod, JDBCConfiguration conf) { if (StringUtil.isEmpty(prod)) return null; prod = prod.toLowerCase(Locale.ENGLISH); PluginValue dbdictionaryPlugin = ((JDBCConfigurationImpl) conf) .dbdictionaryPlugin; if (prod.indexOf("oracle") != -1) ...
206364_37
@Override public String getDefaultSchemaName() { if (defaultSchemaName == null) { Connection conn = null; Statement stmnt = null; ResultSet rs = null; try { String str = "SELECT CURRENT SCHEMA FROM " + SYSDUMMY; conn = getConnection(); if (conn !=...
206364_38
@Override public void connectedConfiguration(Connection conn) throws SQLException { super.connectedConfiguration(conn); DatabaseMetaData metaData = conn.getMetaData(); String driverName = metaData.getDriverName(); if (driverName != null && driverName.startsWith("IBM DB2")) driverVendor = VENDOR_...
206364_39
public String toSnakeCase(final String name) { final StringBuilder out = new StringBuilder(name.length() + 3); final boolean isDelimited = name.startsWith(getLeadingDelimiter()) && name.endsWith(getTrailingDelimiter()); final String toConvert; if (isDelimited) { toConvert = name.substring(2, nam...
206364_40
@Override public int getBatchFetchSize(int batchFetchSize) { return Integer.MIN_VALUE; }
206364_41
public static boolean isProperty(int code) { return (code & PROPERTY) != 0; }
206364_42
public static boolean isField(int code) { return (code & FIELD) != 0; }
206364_43
public static boolean isExplicit(int code) { return (code & EXPLICIT) != 0; }
206364_44
public static boolean isMixed(int code) { return (code & MIXED) != 0; }
206364_45
public static String toClassString(int code) { if (!isValidClassCode(code)) return "invalid code " + code; if (code == UNKNOWN) return "unknown access"; if (code == EMPTY) return "empty access"; return (isMixed(code) ? "mixed " : "") + (isExplicit(code) ? "explicit " : "implicit ") + (isField(code) ...
206364_46
public static boolean isPrimitiveDefault(Object o, int typeCode) { switch (typeCode) { case BOOLEAN: return ((Boolean) o).equals(Boolean.FALSE) ? true : false; case BYTE: return ((Byte) o) == 0 ? true : false; case SHORT: return ((Short) o) == 0 ? true : f...
206364_47
public static boolean isEnhanced(final byte[] b) { if (b == null) { return false; } final ClassReader cr = new ClassReader(b); try { cr.accept(new ClassVisitor(Opcodes.ASM8) { @Override public void visit(final int i, final int i1, ...
206364_48
public boolean isSame(Specification other) { return this == other || (other != null && _name.equalsIgnoreCase(other._name)); }
206364_49
public int compareVersion(Specification other) { return _major > other._major ? 1 : _major == other._major ? 0 : -1; }
2064018_0
public BBox() { }
2064018_1
public void shrink(int xShrink, int yShrink) { xmin += xShrink; xmax -= xShrink; ymin += yShrink; ymax -= yShrink; }
2064018_2
public int getWidth() { return xmax - xmin; }
2064018_3
public int getHeight() { return ymax - ymin; }
2064018_4
public void remap(Point offset) { xmin -= offset.x; xmax -= offset.x; ymin -= offset.y; ymax -= offset.y; }
2064018_5
public boolean contains(Point p) { return xmin <= p.x && p.x <= xmax && ymin <= p.y && p.y <= ymax; }
2064018_6
public boolean overlaps(BBox box) { boolean xOverlap = (xmin <= box.xmin && box.xmin <= xmax) || (box.xmin <= xmin && xmin <= box.xmax); boolean yOverlap = (ymin <= box.ymin && box.ymin <= ymax) || (box.ymin <= ymin && ymin <= box.ymax); return xOverlap && yOverlap; }
2064018_7
public static List<IPMapping> readMappings(File ipDir) { List<IPMapping> mappings = new ArrayList<IPMapping>(); try { FileInputStream fileIn = new FileInputStream(new File(ipDir, "index.txt")); DataInputStream in = new DataInputStream(fileIn); try { byte type ...
2064018_8
public static Point getPoint(long s, int n) { long state, x, y; state = 0; /* Initialize. */ x = 0; y = 0; for (int i = 2 * n - 2; i >= 0; i -= 2) { /* Do n times. */ long row = 4 * state | ((s >> i) & 3); /* Row in table. */ x = (x << 1) | ((0x936C >> row) & 1); y = (y << 1)...
2064018_9
public static Point getPoint(long s, int n) { long state, x, y; state = 0; /* Initialize. */ x = 0; y = 0; for (int i = 2 * n - 2; i >= 0; i -= 2) { /* Do n times. */ long row = 4 * state | ((s >> i) & 3); /* Row in table. */ x = (x << 1) | ((0x936C >> row) & 1); y = (y << 1)...
206402_10
@Override public void process(final HttpRequest request, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); Args.notNull(context, "HTTP context"); final String method = request.getMethod(); if (method.equalsIgnoreCase...
206402_11
@Override public void process(final HttpRequest request, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); Args.notNull(context, "HTTP context"); final String method = request.getMethod(); if (method.equalsIgnoreCase...
206402_12
@Override public void process(final HttpRequest request, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); Args.notNull(context, "HTTP context"); final String method = request.getMethod(); if (method.equalsIgnoreCase...
206402_13
@Override public void process(final HttpRequest request, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); Args.notNull(context, "HTTP context"); final String method = request.getMethod(); if (method.equalsIgnoreCase...
206402_14
@Override public void process(final HttpRequest request, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); Args.notNull(context, "HTTP context"); final String method = request.getMethod(); if (method.equalsIgnoreCase...
206402_15
@Override public void process(final HttpRequest request, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); Args.notNull(context, "HTTP context"); final String method = request.getMethod(); if (method.equalsIgnoreCase...
206402_16
@Override public void process(final HttpRequest request, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); Args.notNull(context, "HTTP context"); final String method = request.getMethod(); if (method.equalsIgnoreCase...
206402_17
@Override public void process(final HttpRequest request, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); Args.notNull(context, "HTTP context"); final String method = request.getMethod(); if (method.equalsIgnoreCase...
206402_18
@Override public void process(final HttpRequest request, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); Args.notNull(context, "HTTP context"); final String method = request.getMethod(); if (method.equalsIgnoreCase...
206402_19
@Override public void process(final HttpRequest request, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); Args.notNull(context, "HTTP context"); final String method = request.getMethod(); if (method.equalsIgnoreCase...
206402_20
@Override public void process(final HttpRequest request, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); Args.notNull(context, "HTTP context"); final String method = request.getMethod(); if (method.equalsIgnoreCase...
206402_21
@Override public void process(final HttpRequest request, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); Args.notNull(context, "HTTP context"); final String method = request.getMethod(); if (method.equalsIgnoreCase...
206402_22
@Override public void process(final HttpRequest request, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); Args.notNull(context, "HTTP context"); final String method = request.getMethod(); if (method.equalsIgnoreCase...
206402_23
@Override public void process(final HttpRequest request, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); Args.notNull(context, "HTTP context"); final String method = request.getMethod(); if (method.equalsIgnoreCase...
206402_24
@Override public void process(final HttpRequest request, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); if (!request.containsHeader(HttpHeaders.EXPECT)) { final ProtocolVersion version = request.getVersion() != nu...
206402_25
@Override public void process(final HttpRequest request, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); if (!request.containsHeader(HttpHeaders.EXPECT)) { final ProtocolVersion version = request.getVersion() != nu...
206402_26
@Override public void process(final HttpRequest request, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); if (!request.containsHeader(HttpHeaders.EXPECT)) { final ProtocolVersion version = request.getVersion() != nu...
206402_27
@Override public void process(final HttpRequest request, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); if (!request.containsHeader(HttpHeaders.EXPECT)) { final ProtocolVersion version = request.getVersion() != nu...
206402_28
@Override public void process(final HttpRequest request, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); if (!request.containsHeader(HttpHeaders.EXPECT)) { final ProtocolVersion version = request.getVersion() != nu...
206402_29
@Override public void process(final HttpRequest request, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(request, "HTTP request"); if (!request.containsHeader(HttpHeaders.EXPECT)) { final ProtocolVersion version = request.getVersion() != nu...
206402_30
@Override public void process(final HttpResponse response, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(response, "HTTP request"); Args.notNull(context, "HTTP context"); final HttpClientContext clientContext = HttpClientContext.adapt(context...
206402_31
@Override public void process(final HttpResponse response, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(response, "HTTP request"); Args.notNull(context, "HTTP context"); final HttpClientContext clientContext = HttpClientContext.adapt(context...
206402_32
@Override public void process(final HttpResponse response, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(response, "HTTP request"); Args.notNull(context, "HTTP context"); final HttpClientContext clientContext = HttpClientContext.adapt(context...
206402_33
@Override public void process(final HttpResponse response, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(response, "HTTP request"); Args.notNull(context, "HTTP context"); final HttpClientContext clientContext = HttpClientContext.adapt(context...