_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q167400
EventStreams.repeatOnInvalidation
validation
public static <O extends Observable> EventStream<O> repeatOnInvalidation(O observable) { return new EventStreamBase<O>() { @Override protected Subscription observeInputs() { InvalidationListener listener = obs -> emit(observable); observable.addListene...
java
{ "resource": "" }
q167401
EventStreams.animationFrames
validation
public static EventStream<Long> animationFrames() { return animationTicks() .accumulate(t(0L, -1L), (state, now) -> state.map((d, last) -> { return t(last == -1L ? 0L : now - last, now); })) .map(t -> t._1); }
java
{ "resource": "" }
q167402
EventStreams.merge
validation
public static <T> EventStream<T> merge( ObservableSet<? extends EventStream<T>> set) { return new EventStreamBase<T>() { @Override protected Subscription observeInputs() { return Subscription.dynamic(set, s -> s.subscribe(this::emit)); } };...
java
{ "resource": "" }
q167403
Collections.wrap
validation
@Deprecated public static <E> ObservableList<E> wrap(javafx.collections.ObservableList<E> delegate) { return LiveList.suspendable(delegate); }
java
{ "resource": "" }
q167404
Indicator.onWhile
validation
public <T> T onWhile(Supplier<T> f) { try(Guard g = on()) { return f.get(); } }
java
{ "resource": "" }
q167405
ProxyObservable.observe
validation
@Override public final Subscription observe(O observer) { P adapted = adaptObserver(observer); underlying.addObserver(adapted); return () -> underlying.removeObserver(adapted); }
java
{ "resource": "" }
q167406
Metadata.copy
validation
public Metadata copy() { Metadata result = new Metadata(); result.setEncoding(encoding); result.setTrailingSlash(trailingSlash); result.setLeadingSlash(leadingSlash); return result; }
java
{ "resource": "" }
q167407
AbstractClassFinder.stripKnownPrefix
validation
protected String stripKnownPrefix(String str, String prefix) { int startIndex = str.lastIndexOf(prefix); if (startIndex != -1) { return str.substring(startIndex + prefix.length()); } return null; }
java
{ "resource": "" }
q167408
DigesterPrettyConfigParser.configureDigester
validation
private Digester configureDigester(final Digester digester) { /* * We use the context class loader to resolve classes. This fixes * ClassNotFoundExceptions on Geronimo. */ digester.setUseContextClassLoader(true); /* * Parse RewriteRules */ digester.addObje...
java
{ "resource": "" }
q167409
PrettyAnnotationHandler.processClassMappingAnnotations
validation
public String[] processClassMappingAnnotations(Class<?> clazz) { // list of all mapping IDs found on the class List<String> classMappingIds = new ArrayList<String>(); // get reference to @URLMapping annotation URLMapping mappingAnnotation = (URLMapping) clazz.getAnnotation(URLMapping.class)...
java
{ "resource": "" }
q167410
PrettyAnnotationHandler.join
validation
private static String join(String[] values, String separator) { StringBuilder result = new StringBuilder(); if (values != null) { for (int i = 0; i < values.length; i++) { if (i > 0) { result.append(separator); } resul...
java
{ "resource": "" }
q167411
UserAgentUtil.initDeviceScan
validation
public void initDeviceScan() { // Save these properties to speed processing this.isWebkit = detectWebkit(); this.isIphone = detectIphone(); this.isAndroid = detectAndroid(); this.isAndroidPhone = detectAndroidPhone(); // Generally, these tiers are the most useful for web developm...
java
{ "resource": "" }
q167412
UserAgentUtil.detectIphone
validation
public boolean detectIphone() { if ((this.initCompleted == true) || (this.isIphone == true)) return this.isIphone; // The iPad and iPod touch say they're an iPhone! So let's disambiguate. if (userAgent.indexOf(deviceIphone) != -1 && !detectIpad() && ...
java
{ "resource": "" }
q167413
UserAgentUtil.detectWebkit
validation
public boolean detectWebkit() { if ((this.initCompleted == true) || (this.isWebkit == true)) return this.isWebkit; if (userAgent.indexOf(engineWebKit) != -1) { return true; } return false; }
java
{ "resource": "" }
q167414
UserAgentUtil.detectWindowsMobile
validation
public boolean detectWindowsMobile() { if (detectWindowsPhone()) { return false; } // Most devices use 'Windows CE', but some report 'iemobile' // and some older ones report as 'PIE' for Pocket IE. // We also look for instances of HTC and Windows for many of their WinMo devices...
java
{ "resource": "" }
q167415
UserAgentUtil.detectBlackBerry
validation
public boolean detectBlackBerry() { if (userAgent.indexOf(deviceBB) != -1 || httpAccept.indexOf(vndRIM) != -1) return true; if (detectBlackBerry10Phone()) return true; return false; }
java
{ "resource": "" }
q167416
UserAgentUtil.detectS60OssBrowser
validation
public boolean detectS60OssBrowser() { // First, test for WebKit, then make sure it's either Symbian or S60. if (detectWebkit() && (userAgent.indexOf(deviceSymbian) != -1 || userAgent.indexOf(deviceS60) != -1)) { return true; } return false; }
java
{ "resource": "" }
q167417
UserAgentUtil.detectPalmOS
validation
public boolean detectPalmOS() { // Make sure it's not WebOS first if (detectPalmWebOS()) return false; // Most devices nowadays report as 'Palm', but some older ones reported as Blazer or Xiino. if (userAgent.indexOf(devicePalm) != -1 || userAgent.indexOf(engineBlazer...
java
{ "resource": "" }
q167418
UserAgentUtil.detectOperaAndroidPhone
validation
public boolean detectOperaAndroidPhone() { if (userAgent.indexOf(engineOpera) != -1 && (userAgent.indexOf(deviceAndroid) != -1 && userAgent.indexOf(mobi) != -1)) { return true; } return false; }
java
{ "resource": "" }
q167419
UserAgentUtil.detectOperaAndroidTablet
validation
public boolean detectOperaAndroidTablet() { if (userAgent.indexOf(engineOpera) != -1 && (userAgent.indexOf(deviceAndroid) != -1 && userAgent.indexOf(deviceTablet) != -1)) { return true; } return false; }
java
{ "resource": "" }
q167420
UserAgentUtil.detectMaemoTablet
validation
public boolean detectMaemoTablet() { if (userAgent.indexOf(maemo) != -1) { return true; } else if (userAgent.indexOf(linux) != -1 && userAgent.indexOf(deviceTablet) != -1 && !detectWebOSTablet() && !detectAndroid()) { return true; ...
java
{ "resource": "" }
q167421
UserAgentUtil.detectMobileQuick
validation
public boolean detectMobileQuick() { // Let's exclude tablets if (detectTierTablet()) return false; if ((initCompleted == true) || (isMobilePhone == true)) return isMobilePhone; // Most mobile browsing is done on smartphones if (detectSmartphone()) ...
java
{ "resource": "" }
q167422
UserAgentUtil.detectTierIphone
validation
public boolean detectTierIphone() { if ((this.initCompleted == true) || (this.isTierIphone == true)) return this.isTierIphone; if (detectIphoneOrIpod() || detectAndroidPhone() || detectWindowsPhone() || detectBlackBerry10Phone() ...
java
{ "resource": "" }
q167423
UserAgentUtil.detectTierOtherPhones
validation
public boolean detectTierOtherPhones() { if ((this.initCompleted == true) || (this.isTierGenericMobile == true)) return this.isTierGenericMobile; // Exclude devices in the other 2 categories if (detectMobileLong() && !detectTierIphone() && !det...
java
{ "resource": "" }
q167424
Expressions.isEL
validation
public static boolean isEL(final String value) { if (value == null) { return false; } return elPattern.matcher(value).matches(); }
java
{ "resource": "" }
q167425
Expressions.containsEL
validation
public static boolean containsEL(final String value) { if (value == null) { return false; } return elPattern.matcher(value).find(); }
java
{ "resource": "" }
q167426
LocationBehavior.buildScriptInternal
validation
private String buildScriptInternal(final String url) { StringBuilder builder = new StringBuilder(); builder.append("window.location.href = '"); builder.append(url); builder.append("'; return false;"); return builder.toString(); }
java
{ "resource": "" }
q167427
El.method
validation
public static El method(final String retrieve, final String submit) { return new ElMethod(new ConstantExpression(retrieve), new ConstantExpression(submit)); }
java
{ "resource": "" }
q167428
ByteCodeFilter.containsFieldDescriptor
validation
private boolean containsFieldDescriptor(String str) { for (String descriptor : fieldDescriptors) { if (str.contains(descriptor)) { return true; } } return false; }
java
{ "resource": "" }
q167429
ProxyServlet.copyResponseHeaders
validation
protected void copyResponseHeaders(HttpResponse proxyResponse, HttpServletResponse servletResponse) { for (Header header : proxyResponse.getAllHeaders()) { if (hopByHopHeaders.containsHeader(header.getName())) continue; servletResponse.addHeader(header.getName(), header.getV...
java
{ "resource": "" }
q167430
ProxyServlet.encodeUriQuery
validation
protected static CharSequence encodeUriQuery(CharSequence in) { /* * Note that I can't simply use URI.java to encode because it will escape pre-existing escaped things. TODO: * replace/compare to with Rewrite Encoding */ StringBuilder outBuf = null; Formatter formatter = null; ...
java
{ "resource": "" }
q167431
URLBuilder.toURI
validation
public URI toURI() { try { URI uri = new URI(toURL()); return uri; } catch (URISyntaxException e) { throw new IllegalStateException("URL cannot be parsed.", e); } }
java
{ "resource": "" }
q167432
QueryString.build
validation
public static QueryString build(final String url) { QueryString queryString = new QueryString(); queryString.addParameters(url); return queryString; }
java
{ "resource": "" }
q167433
QueryString.getParameter
validation
public String getParameter(final String name) { List<String> values = parameters.get(name); if (values == null) { return null; } if (values.size() == 0) { return ""; } return values.get(0); }
java
{ "resource": "" }
q167434
QueryString.getParameterValues
validation
public String[] getParameterValues(final String name) { List<String> values = parameters.get(name); if (values == null) { return null; } return values.toArray(new String[values.size()]); }
java
{ "resource": "" }
q167435
QueryString.addParameters
validation
public void addParameters(String url) { if ((url != null) && !"".equals(url)) { url = url.trim(); if (url.length() > 1) { if (url.contains("?")) { url = url.substring(url.indexOf('?') + 1); } String pairs[] = url.s...
java
{ "resource": "" }
q167436
RewriteViewHandler.deriveViewId
validation
@Override public String deriveViewId(final FacesContext context, final String rawViewId) { String canonicalViewId = new URLDuplicatePathCanonicalizer().canonicalize(rawViewId); return parent.deriveViewId(context, canonicalViewId); }
java
{ "resource": "" }
q167437
UrlMapping.getPatternParser
validation
public URLPatternParser getPatternParser() { if ((parser == null) && (pattern != null)) { this.parser = new URLPatternParser(pattern); } return parser; }
java
{ "resource": "" }
q167438
UrlMapping.getValidatorsForPathParam
validation
public List<PathValidator> getValidatorsForPathParam(final PathParameter param) { List<PathValidator> result = new ArrayList<PathValidator>(); for (PathValidator pv : pathValidators) { if (pv.getIndex() == param.getPosition()) { result.add(pv); } } ...
java
{ "resource": "" }
q167439
QueryStringBuilder.createFromEncoded
validation
public static QueryStringBuilder createFromEncoded(final String parameters) { QueryStringBuilder queryString = new QueryStringBuilder(); queryString.addParameters(parameters); return queryString; }
java
{ "resource": "" }
q167440
QueryStringBuilder.extractQuery
validation
public static String extractQuery(String url) { if (url != null) { int index = url.indexOf('?'); if (index >= 0) { url = url.substring(index + 1); } } return url; }
java
{ "resource": "" }
q167441
QueryStringBuilder.addParameter
validation
public void addParameter(final String name, final String... values) { Map<String, String[]> parameter = new LinkedHashMap<String, String[]>(); parameter.put(name, values); addParameterArrays(parameter); }
java
{ "resource": "" }
q167442
DispatchType.getDispatcherTypeProviders
validation
@SuppressWarnings("unchecked") private List<DispatcherTypeProvider> getDispatcherTypeProviders(HttpServletRewrite event) { List<DispatcherTypeProvider> providers = (List<DispatcherTypeProvider>) event.getRequest().getAttribute(PROVIDER_KEY); if (providers == null) { providers =...
java
{ "resource": "" }
q167443
Conditions.getNegationCount
validation
public static int getNegationCount(final EvaluationContext context) { if (context == null) return 0; Integer count = (Integer)context.get(NEGATION_COUNT_KEY); return count == null ? 0 : count; }
java
{ "resource": "" }
q167444
Navigate.with
validation
public Navigate with(CharSequence name, Object value) { Assert.notNull(name, "name must not be null"); if (value != null) { parameters.put(name.toString(), value.toString()); } return this; }
java
{ "resource": "" }
q167445
Navigate.buildStandardOutcome
validation
private String buildStandardOutcome() { StringBuilder outcome = new StringBuilder(); outcome.append(viewId); boolean first = true; for (Entry<String, List<String>> param : parameters.entrySet()) { for (String value : param.getValue()) { outcome.append(first ? '?' : '&'...
java
{ "resource": "" }
q167446
WebClassesFinder.handleClassEntry
validation
private void handleClassEntry(String entryName, ClassVisitor visitor) { // build class name from relative name String className = getClassName(entryName.substring(CLASSES_FOLDER.length())); // check filter if (mustProcessClass(className) && !processedClasses.contains(className)) { ...
java
{ "resource": "" }
q167447
AddressBuilder.queryLiteral
validation
AddressBuilderQuery queryLiteral(String query) { if (query != null) { if (query.startsWith("?")) query = query.substring(1); /* * Linked hash map is important here in order to retain the order of query parameters. */ Map<CharSequence, List<CharS...
java
{ "resource": "" }
q167448
EncodeQuery.excluding
validation
public EncodeQuery excluding(final String... params) { if ((params != null) && (params.length > 0)) this.excludedParams.addAll(Arrays.asList(params)); return this; }
java
{ "resource": "" }
q167449
ExtractedValuesURLBuilder.buildURL
validation
public URL buildURL(final UrlMapping mapping) { URL result = null; String expression = ""; Object value = null; try { FacesContext context = FacesContext.getCurrentInstance(); URLPatternParser parser = mapping.getPatternParser(); List<PathParameter> paramete...
java
{ "resource": "" }
q167450
PrettyContext.sendError
validation
public void sendError(int code, String message, HttpServletResponse response) { Assert.notNull(response, "HttpServletResponse argument was null"); try { if (message != null) { response.sendError(code, message); } else { response.s...
java
{ "resource": "" }
q167451
ClassVisitorImpl.visit
validation
@Override public void visit(Class<?> clazz) { ClassContextImpl context = new ClassContextImpl(builder, clazz); context.put(clazz, payload); if (log.isTraceEnabled()) { log.trace("Scanning class: {}", clazz.getName()); } // first process the class visit(clazz, ...
java
{ "resource": "" }
q167452
RewriteNavigationHandler.prependContextPath
validation
private String prependContextPath(ExternalContext externalContext, String url) { String contextPath = externalContext.getRequestContextPath(); if ("/".equals(contextPath) || (url.startsWith(contextPath))) { return url; } return contextPath + url; }
java
{ "resource": "" }
q167453
OutboundRewriteRuleAdaptor.stripContextPath
validation
private String stripContextPath(final String contextPath, String uri) { if (!contextPath.equals("/") && uri.startsWith(contextPath)) { uri = uri.substring(contextPath.length()); } return uri; }
java
{ "resource": "" }
q167454
LocaleTransposition.translate
validation
private String translate(String lang, String value) { String translatation = null; if (value != null) { if (!bundleMap.containsKey(lang)) { Locale locale = new Locale(lang); try { ResourceBundle loadedBundle = ResourceBundle.getBu...
java
{ "resource": "" }
q167455
DynaviewEngine.buildDynaViewId
validation
public String buildDynaViewId(final String facesServletMapping) { StringBuffer result = new StringBuffer(); Map<Pattern, String> patterns = new LinkedHashMap<Pattern, String>(); Pattern pathMapping = Pattern.compile("^(/.*/)\\*$"); Pattern extensionMapping = Pattern.compile("^\\*(\\..*)$");...
java
{ "resource": "" }
q167456
DynaviewEngine.processDynaView
validation
public void processDynaView(final PrettyContext prettyContext, final FacesContext facesContext) { log.trace("Requesting DynaView processing for: " + prettyContext.getRequestURL()); String viewId = ""; try { viewId = prettyContext.getCurrentViewId(); log.trace("Invoking DynaV...
java
{ "resource": "" }
q167457
CdiServiceLocator.getRequiredType
validation
private Type getRequiredType(Class<?> clazz) { TypeVariable<?>[] typeParameters = clazz.getTypeParameters(); if (typeParameters.length > 0) { Type[] actualTypeParameters = new Type[typeParameters.length]; for (int i = 0; i < typeParameters.length; i++) { actualTypeParamet...
java
{ "resource": "" }
q167458
AnnotationProxyFactory.getAnnotationProxy
validation
@SuppressWarnings("unchecked") public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T)Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), ...
java
{ "resource": "" }
q167459
ObjectGraphWalker.getFilteredFields
validation
private Collection<Field> getFilteredFields(Class<?> refClass) { SoftReference<Collection<Field>> ref = fieldCache.get(refClass); Collection<Field> fieldList = ref != null ? ref.get() : null; if (fieldList != null) { return fieldList; } else { Collection<Field> re...
java
{ "resource": "" }
q167460
ObjectGraphWalker.getAllFields
validation
private static Collection<Field> getAllFields(Class<?> refClass) { Collection<Field> fields = new ArrayList<>(); for (Class<?> klazz = refClass; klazz != null; klazz = klazz.getSuperclass()) { for (Field field : klazz.getDeclaredFields()) { if (!Modifier.isStatic(field.getMod...
java
{ "resource": "" }
q167461
WeakIdentityConcurrentMap.put
validation
public V put(K key, V value) { cleanUp(); return map.put(new IdentityWeakReference<>(key, queue), value); }
java
{ "resource": "" }
q167462
WeakIdentityConcurrentMap.remove
validation
public V remove(K key) { cleanUp(); return map.remove(new IdentityWeakReference<>(key, queue)); }
java
{ "resource": "" }
q167463
AgentLoader.loadAgent
validation
static boolean loadAgent() { synchronized (AgentLoader.class.getName().intern()) { if (!agentIsAvailable() && VIRTUAL_MACHINE_LOAD_AGENT != null) { try { warnIfOSX(); String name = ManagementFactory.getRuntimeMXBean().getName(); ...
java
{ "resource": "" }
q167464
AgentLoader.agentIsAvailable
validation
static boolean agentIsAvailable() { try { if (instrumentation == null) { instrumentation = (Instrumentation)System.getProperties().get(INSTRUMENTATION_INSTANCE_SYSTEM_PROPERTY_NAME); } if (instrumentation == null) { Class<?> sizeOfAgentClass = ...
java
{ "resource": "" }
q167465
ResourceUtils.copyFile
validation
public static void copyFile( PlexusIoResource in, File outFile ) throws IOException { InputStream input = null; OutputStream output = null; try { input = in.getContents(); output = new FileOutputStream( outFile ); IOUtil.copy( input, output...
java
{ "resource": "" }
q167466
ResourceUtils.isSame
validation
public static boolean isSame( PlexusIoResource resource, File file ) { if ( resource instanceof FileSupplier ) { File resourceFile = ((FileSupplier) resource).getFile(); return file.equals( resourceFile ); } return false; }
java
{ "resource": "" }
q167467
WarArchiver.addWebinf
validation
public void addWebinf( File directoryName, String[] includes, String[] excludes ) throws ArchiverException { addDirectory( directoryName, "WEB-INF/", includes, excludes ); }
java
{ "resource": "" }
q167468
WarArchiver.initZipOutputStream
validation
protected void initZipOutputStream( ZipArchiveOutputStream zOut ) throws ArchiverException, IOException { // If no webxml file is specified, it's an error. if ( expectWebXml && deploymentDescriptor == null && !isInUpdateMode() ) { throw new ArchiverException( "webxml attr...
java
{ "resource": "" }
q167469
WarArchiver.zipFile
validation
protected void zipFile( ArchiveEntry entry, ZipArchiveOutputStream zOut, String vPath ) throws IOException, ArchiverException { // If the file being added is WEB-INF/web.xml, we warn if it's // not the one specified in the "webxml" attribute - or if // it's being added twice, meaning...
java
{ "resource": "" }
q167470
Manifest.getDefaultManifest
validation
public static Manifest getDefaultManifest() throws ArchiverException { try { String defManifest = "/org/codehaus/plexus/archiver/jar/defaultManifest.mf"; InputStream in = Manifest.class.getResourceAsStream( defManifest ); if ( in == null ) { ...
java
{ "resource": "" }
q167471
Manifest.addConfiguredSection
validation
public void addConfiguredSection( Section section ) throws ManifestException { String sectionName = section.getName(); if ( sectionName == null ) { throw new ManifestException( "Sections must have a name" ); } Attributes attributes = getOrCreateAttributes(...
java
{ "resource": "" }
q167472
Manifest.write
validation
public void write( PrintWriter writer ) throws IOException { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); super.write( byteArrayOutputStream ); for ( byte b : byteArrayOutputStream.toByteArray() ) { writer.write( (char) b ); }...
java
{ "resource": "" }
q167473
Manifest.getWarnings
validation
Enumeration<String> getWarnings() { Vector<String> warnings = new Vector<String>(); Enumeration<String> warnEnum = mainSection.getWarnings(); while ( warnEnum.hasMoreElements() ) { warnings.addElement( warnEnum.nextElement() ); } return warnings.elements...
java
{ "resource": "" }
q167474
Manifest.getSection
validation
public ExistingSection getSection( String name ) { Attributes attributes = getAttributes( name ); if ( attributes != null ) { return new ExistingSection( attributes, name ); } return null; }
java
{ "resource": "" }
q167475
DirectoryArchiver.copyFile
validation
protected void copyFile( final ArchiveEntry entry, final String vPath ) throws ArchiverException, IOException { // don't add "" to the archive if ( vPath.length() <= 0 ) { return; } final PlexusIoResource in = entry.getResource(); final File outFi...
java
{ "resource": "" }
q167476
JarArchiver.addConfiguredManifest
validation
public void addConfiguredManifest( Manifest newManifest ) throws ManifestException { if ( configuredManifest == null ) { configuredManifest = newManifest; } else { JdkManifestFactory.merge( configuredManifest, newManifest, false ); } ...
java
{ "resource": "" }
q167477
JarArchiver.zipFile
validation
protected void zipFile( InputStream is, ZipArchiveOutputStream zOut, String vPath, long lastModified, File fromArchive, int mode, String symlinkDestination ) throws IOException, ArchiverException { if ( MANIFEST_NAME.equalsIgnoreCase( vPath ) ) { if ( ...
java
{ "resource": "" }
q167478
JarArchiver.cleanUp
validation
protected void cleanUp() throws IOException { super.cleanUp(); // we want to save this info if we are going to make another pass if ( !doubleFilePass || !skipWriting ) { manifest = null; configuredManifest = savedConfiguredManifest; filese...
java
{ "resource": "" }
q167479
JarArchiver.reset
validation
public void reset() { super.reset(); configuredManifest = null; filesetManifestConfig = null; mergeManifestsMain = false; manifestFile = null; index = false; }
java
{ "resource": "" }
q167480
JarArchiver.writeIndexLikeList
validation
protected final void writeIndexLikeList( List<String> dirs, List<String> files, PrintWriter writer ) { // JarIndex is sorting the directories by ascending order. // it has no value but cosmetic since it will be read into a // hashtable by the classloader, but we'll do so anyway. Coll...
java
{ "resource": "" }
q167481
JarArchiver.grabFilesAndDirs
validation
protected static void grabFilesAndDirs( String file, List<String> dirs, List<String> files ) throws IOException { File zipFile = new File( file ); if ( !zipFile.exists() ) { Logger logger = new ConsoleLogger( Logger.LEVEL_INFO, "console" ); logger.error( "JarA...
java
{ "resource": "" }
q167482
TarUnArchiver.decompress
validation
private InputStream decompress( UntarCompressionMethod compression, final File file, final InputStream istream ) throws IOException, ArchiverException { if ( compression == UntarCompressionMethod.GZIP ) { return new GZIPInputStream( istream ); } else if ( compression == UntarCompressionMethod.BZIP2 ) {...
java
{ "resource": "" }
q167483
GZipCompressor.compress
validation
public void compress() throws ArchiverException { try { zOut = new GZIPOutputStream( Streams.bufferedOutputStream( new FileOutputStream( getDestFile() ) )); compress( getSource(), zOut ); } catch ( IOException ioe ) { String msg = "...
java
{ "resource": "" }
q167484
JdkManifestFactory.mergeAttributes
validation
public static void mergeAttributes( java.util.jar.Attributes target, java.util.jar.Attributes section ) { for ( Object o : section.keySet() ) { java.util.jar.Attributes.Name key = (Attributes.Name) o; final Object value = section.get( o ); // the merge file always...
java
{ "resource": "" }
q167485
EarArchiver.setAppxml
validation
public void setAppxml( File descr ) throws ArchiverException { deploymentDescriptor = descr; if ( !deploymentDescriptor.exists() ) { throw new ArchiverException( "Deployment descriptor: " + deploymentDescriptor + " does not exist." ); } addFile( descr, "M...
java
{ "resource": "" }
q167486
EarArchiver.addArchive
validation
public void addArchive( File fileName ) throws ArchiverException { addDirectory( fileName.getParentFile(), "/", new String[]{fileName.getName()}, null ); }
java
{ "resource": "" }
q167487
EarArchiver.addArchives
validation
public void addArchives( File directoryName, String[] includes, String[] excludes ) throws ArchiverException { addDirectory( directoryName, "/", includes, excludes ); }
java
{ "resource": "" }
q167488
SnappyCompressor.compress
validation
public void compress() throws ArchiverException { try { zOut = new SnappyOutputStream( bufferedOutputStream( fileOutputStream( getDestFile() ) ) ); compress( getSource(), zOut ); } catch ( IOException ioe ) { String msg = "Problem c...
java
{ "resource": "" }
q167489
AbstractZipArchiver.addResources
validation
@SuppressWarnings({"JavaDoc"}) protected final void addResources( ResourceIterator resources, ZipArchiveOutputStream zOut ) throws IOException, ArchiverException { File base = null; while ( resources.hasNext() ) { ArchiveEntry entry = resources.next(); St...
java
{ "resource": "" }
q167490
AbstractZipArchiver.addParentDirs
validation
@SuppressWarnings({"JavaDoc"}) private void addParentDirs( ArchiveEntry archiveEntry, File baseDir, String entry, ZipArchiveOutputStream zOut, String prefix ) throws IOException { if ( !doFilesonly && getIncludeEmptyDirs() ) { Stack<String> dir...
java
{ "resource": "" }
q167491
AbstractZipArchiver.zipFile
validation
@SuppressWarnings({"JavaDoc"}) protected void zipFile( InputStream in, ZipArchiveOutputStream zOut, String vPath, long lastModified, File fromArchive, int mode, String symlinkDestination ) throws IOException, ArchiverException { getLogger().debug( "adding entry " + vP...
java
{ "resource": "" }
q167492
AbstractZipArchiver.createEmptyZip
validation
@SuppressWarnings({"JavaDoc"}) protected boolean createEmptyZip( File zipFile ) throws ArchiverException { // In this case using java.util.zip will not work // because it does not permit a zero-entry archive. // Must create it manually. getLogger().info( "Note: creating e...
java
{ "resource": "" }
q167493
AbstractZipArchiver.reset
validation
public void reset() { setDestFile( null ); // duplicate = "add"; archiveType = "zip"; doCompress = true; doUpdate = false; doFilesonly = false; encoding = null; }
java
{ "resource": "" }
q167494
Compressor.compressFile
validation
private void compressFile( InputStream in, OutputStream zOut ) throws IOException { byte[] buffer = new byte[8 * 1024]; int count = 0; do { zOut.write( buffer, 0, count ); count = in.read( buffer, 0, buffer.length ); } while ( count != ...
java
{ "resource": "" }
q167495
Compressor.compress
validation
protected void compress( PlexusIoResource resource, OutputStream zOut ) throws IOException { InputStream in = Streams.bufferedInputStream( resource.getContents() ); try { compressFile( in, zOut ); } finally { IOUtil.close( in ); ...
java
{ "resource": "" }
q167496
Decoder.setMaxHeaderTableSize
validation
public void setMaxHeaderTableSize(int maxHeaderTableSize) { maxDynamicTableSize = maxHeaderTableSize; if (maxDynamicTableSize < encoderMaxDynamicTableSize) { // decoder requires less space than encoder // encoder MUST signal this change maxDynamicTableSizeChangeRequired = true; dynamicTa...
java
{ "resource": "" }
q167497
Decoder.decodeULE128
validation
private static int decodeULE128(InputStream in) throws IOException { in.mark(5); int result = 0; int shift = 0; while (shift < 32) { if (in.available() == 0) { // Buffer does not contain entire integer, // reset reader index and return -1. in.reset(); return -1; ...
java
{ "resource": "" }
q167498
StaticTable.getIndex
validation
static int getIndex(byte[] name) { String nameString = new String(name, 0, name.length, ISO_8859_1); Integer index = STATIC_INDEX_BY_NAME.get(nameString); if (index == null) { return -1; } return index; }
java
{ "resource": "" }
q167499
StaticTable.getIndex
validation
static int getIndex(byte[] name, byte[] value) { int index = getIndex(name); if (index == -1) { return -1; } // Note this assumes all entries for a given header field are sequential. while (index <= length) { HeaderField entry = getEntry(index); if (!HpackUtil.equals(name, entry.n...
java
{ "resource": "" }