Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
maven-embedder-3.5.4.jar - Maven Embedder Module
maven-embedder-3.5.4.jar is the JAR file for Apache Maven 3.5.4 Embedder module.
Apache Maven is a software project management and comprehension tool.
JAR File Size and Download Location:
File: 2018-06-17 19:34 98372 lib\maven-embedder-3.5.4.jar Download: Apache Maven Website
✍: FYIcenter.com
⏎ org/apache/maven/cli/transfer/ConsoleMavenTransferListener.java
package org.apache.maven.cli.transfer;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.io.PrintStream;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.aether.transfer.TransferCancelledException;
import org.eclipse.aether.transfer.TransferEvent;
import org.eclipse.aether.transfer.TransferResource;
/**
* Console download progress meter.
*
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
*/
public class ConsoleMavenTransferListener
extends AbstractMavenTransferListener
{
private Map<TransferResource, Long> transfers = Collections.synchronizedMap(
new LinkedHashMap<TransferResource, Long>() );
private boolean printResourceNames;
private int lastLength;
public ConsoleMavenTransferListener( PrintStream out, boolean printResourceNames )
{
super( out );
this.printResourceNames = printResourceNames;
}
@Override
public synchronized void transferInitiated( TransferEvent event )
{
overridePreviousTransfer( event );
super.transferInitiated( event );
}
@Override
public synchronized void transferCorrupted( TransferEvent event )
throws TransferCancelledException
{
overridePreviousTransfer( event );
super.transferCorrupted( event );
}
@Override
public synchronized void transferProgressed( TransferEvent event )
throws TransferCancelledException
{
TransferResource resource = event.getResource();
transfers.put( resource, event.getTransferredBytes() );
StringBuilder buffer = new StringBuilder( 128 );
buffer.append( "Progress (" ).append( transfers.size() ).append( "): " );
synchronized ( transfers )
{
Iterator<Map.Entry<TransferResource, Long>> entries = transfers.entrySet().iterator();
while ( entries.hasNext() )
{
Map.Entry<TransferResource, Long> entry = entries.next();
long total = entry.getKey().getContentLength();
Long complete = entry.getValue();
buffer.append( getStatus( entry.getKey().getResourceName(), complete, total ) );
if ( entries.hasNext() )
{
buffer.append( " | " );
}
}
}
int pad = lastLength - buffer.length();
lastLength = buffer.length();
pad( buffer, pad );
buffer.append( '\r' );
out.print( buffer );
out.flush();
}
private String getStatus( String resourceName, long complete, long total )
{
FileSizeFormat format = new FileSizeFormat( Locale.ENGLISH );
StringBuilder status = new StringBuilder();
if ( printResourceNames )
{
status.append( StringUtils.substringAfterLast( resourceName, "/" ) );
status.append( " (" );
}
status.append( format.formatProgress( complete, total ) );
if ( printResourceNames )
{
status.append( ")" );
}
return status.toString();
}
private void pad( StringBuilder buffer, int spaces )
{
String block = " ";
while ( spaces > 0 )
{
int n = Math.min( spaces, block.length() );
buffer.append( block, 0, n );
spaces -= n;
}
}
@Override
public synchronized void transferSucceeded( TransferEvent event )
{
transfers.remove( event.getResource() );
overridePreviousTransfer( event );
super.transferSucceeded( event );
}
@Override
public synchronized void transferFailed( TransferEvent event )
{
transfers.remove( event.getResource() );
overridePreviousTransfer( event );
super.transferFailed( event );
}
private void overridePreviousTransfer( TransferEvent event )
{
if ( lastLength > 0 )
{
StringBuilder buffer = new StringBuilder( 128 );
pad( buffer, lastLength );
buffer.append( '\r' );
out.print( buffer );
out.flush();
lastLength = 0;
}
}
}
⏎ org/apache/maven/cli/transfer/ConsoleMavenTransferListener.java
Or download all of them as a single archive file:
File name: maven-embedder-3.5.4-src.zip File size: 52996 bytes Release date: 2018-06-17 Download
⇒ maven-settings-builder-3.5.4.jar - Maven Settings Builder Module
⇐ maven-compat-3.5.4.jar - Maven Compact Module
2023-06-19, ∼8259🔥, 0💬
Popular Posts:
JRE 5 sunjce_provider.jar is the JAR file for JRE 5 Sun JCE Provider, which provides implementations...
Java Servlet API 4.0.1 Source Code Files are important if you want to compile them with different JD...
JDK 17 jdk.xml.dom.jmod is the JMOD file for JDK 17 XML DOM module. JDK 17 XML DOM module compiled c...
JDK 1.1 source code directory contains Java source code for JDK 1.1 core classes: "C:\fyicenter\jdk-...
JDK 11 jdk.compiler.jmod is the JMOD file for JDK 11 Compiler tool, which can be invoked by the "jav...