idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
600
public void close ( ) throws SQLException { if ( ( id == null ) || ( poolableConn == null ) ) { internalStmt . close ( ) ; } else { poolableConn . cachePreparedStatement ( this ) ; } }
Method close .
601
public boolean execute ( ) throws SQLException { boolean isOk = false ; try { boolean result = internalStmt . execute ( ) ; isOk = true ; return result ; } finally { poolableConn . updateLastSQLExecutionTime ( isOk ) ; } }
Method execute .
602
public ResultSet executeQuery ( String sql ) throws SQLException { boolean isOk = false ; try { final ResultSet result = wrap ( internalStmt . executeQuery ( sql ) ) ; isOk = true ; return result ; } finally { poolableConn . updateLastSQLExecutionTime ( isOk ) ; } }
Method executeQuery .
603
public void setArray ( int parameterIndex , Array x ) throws SQLException { internalStmt . setArray ( parameterIndex , x ) ; }
Method setArray .
604
public void setAsciiStream ( int parameterIndex , InputStream x , int length ) throws SQLException { internalStmt . setAsciiStream ( parameterIndex , x , length ) ; }
Method setAsciiStream .
605
public void setBigDecimal ( int parameterIndex , BigDecimal x ) throws SQLException { internalStmt . setBigDecimal ( parameterIndex , x ) ; }
Method setBigDecimal .
606
public void setBinaryStream ( int parameterIndex , InputStream x ) throws SQLException { internalStmt . setBinaryStream ( parameterIndex , x ) ; }
Method setBinaryStream .
607
public void setDate ( int parameterIndex , Date x ) throws SQLException { internalStmt . setDate ( parameterIndex , x ) ; }
Method setDate .
608
public void setNCharacterStream ( int parameterIndex , Reader value ) throws SQLException { internalStmt . setNCharacterStream ( parameterIndex , value ) ; }
Method setNCharacterStream .
609
public void setNString ( int parameterIndex , String value ) throws SQLException { internalStmt . setNString ( parameterIndex , value ) ; }
Method setNString .
610
public void setRef ( int parameterIndex , Ref x ) throws SQLException { internalStmt . setRef ( parameterIndex , x ) ; }
Method setRef .
611
public void setRowId ( int parameterIndex , RowId x ) throws SQLException { internalStmt . setRowId ( parameterIndex , x ) ; }
Method setRowId .
612
public void setSQLXML ( int parameterIndex , SQLXML xmlObject ) throws SQLException { internalStmt . setSQLXML ( parameterIndex , xmlObject ) ; }
Method setSQLXML .
613
public void setString ( int parameterIndex , String x ) throws SQLException { internalStmt . setString ( parameterIndex , x ) ; }
Method setString .
614
public void setTime ( int parameterIndex , Time x ) throws SQLException { internalStmt . setTime ( parameterIndex , x ) ; }
Method setTime .
615
public void setTimestamp ( int parameterIndex , Timestamp x ) throws SQLException { internalStmt . setTimestamp ( parameterIndex , x ) ; }
Method setTimestamp .
616
public void setURL ( int parameterIndex , URL x ) throws SQLException { internalStmt . setURL ( parameterIndex , x ) ; }
Method setURL .
617
public boolean cancelAll ( boolean mayInterruptIfRunning ) { boolean res = true ; if ( N . notNullOrEmpty ( upFutures ) ) { for ( ContinuableFuture < ? > preFuture : upFutures ) { res = res & preFuture . cancelAll ( mayInterruptIfRunning ) ; } } return cancel ( mayInterruptIfRunning ) && res ; }
Cancel this future and all the previous stage future recursively .
618
public boolean isAllCancelled ( ) { boolean res = true ; if ( N . notNullOrEmpty ( upFutures ) ) { for ( ContinuableFuture < ? > preFuture : upFutures ) { res = res & preFuture . isAllCancelled ( ) ; } } return isCancelled ( ) && res ; }
Returns true if this future and all previous stage futures have been recursively cancelled otherwise false is returned .
619
public int read ( ) throws IOException { int b = in . read ( ) ; if ( b != - 1 ) { hasher . put ( ( byte ) b ) ; } return b ; }
Reads the next byte of data from the underlying input stream and updates the hasher with the byte read .
620
public int read ( byte [ ] bytes , int off , int len ) throws IOException { int numOfBytesRead = in . read ( bytes , off , len ) ; if ( numOfBytesRead != - 1 ) { hasher . put ( bytes , off , numOfBytesRead ) ; } return numOfBytesRead ; }
Reads the specified bytes of data from the underlying input stream and updates the hasher with the bytes read .
621
public static < T > SortedSet < HBaseColumn < T > > asSortedSet ( T value , long version ) { return asSortedSet ( value , version , DESC_HBASE_COLUMN_COMPARATOR ) ; }
Returns a sorted set descended by version
622
public static < T > SortedMap < Long , HBaseColumn < T > > asSortedMap ( T value ) { return asSortedMap ( value , DESC_HBASE_VERSION_COMPARATOR ) ; }
Returns a sorted map descended by version
623
public static < T > List < T > asList ( T ... a ) { return N . isNullOrEmpty ( a ) ? N . < T > emptyList ( ) : Arrays . asList ( a ) ; }
Returns a fixed - size list backed by the specified array if it s not null or empty otherwise an immutable empty list is returned .
624
@ SuppressWarnings ( "deprecation" ) public CQLBuilder set ( final Object entity ) { if ( entity instanceof String ) { return set ( N . asArray ( ( String ) entity ) ) ; } else if ( entity instanceof Map ) { return set ( ( Map < String , Object > ) entity ) ; } else { this . entityClass = entity . getClass ( ) ; if ( N...
Only the dirty properties will be set into the result CQL if the specified entity is a dirty marker entity .
625
public boolean remove ( Object key , Object value ) { final Object curValue = get ( key ) ; if ( ! Objects . equals ( curValue , value ) || ( curValue == null && ! containsKey ( key ) ) ) { return false ; } remove ( key ) ; return true ; }
Removes the entry for the specified key only if it is currently mapped to the specified value .
626
public boolean replace ( K key , V oldValue , V newValue ) { Object curValue = get ( key ) ; if ( ! Objects . equals ( curValue , oldValue ) || ( curValue == null && ! containsKey ( key ) ) ) { return false ; } put ( key , newValue ) ; return true ; }
Replaces the entry for the specified key only if currently mapped to the specified value .
627
public Stream < T > queued ( int queueSize ) { final Iterator < T > iter = iterator ( ) ; if ( iter instanceof QueuedIterator && ( ( QueuedIterator < ? extends T > ) iter ) . max ( ) >= queueSize ) { return newStream ( elements , sorted , cmp ) ; } else { return newStream ( Stream . parallelConcatt ( Arrays . asList ( ...
Returns a Stream with elements from a temporary queue which is filled by reading the elements from the specified iterator asynchronously .
628
public BiIterator < K , V > iterator ( ) { final ObjIterator < Entry < K , V > > iter = s . iterator ( ) ; final BooleanSupplier hasNext = new BooleanSupplier ( ) { public boolean getAsBoolean ( ) { return iter . hasNext ( ) ; } } ; final Consumer < Pair < K , V > > output = new Consumer < Pair < K , V > > ( ) { privat...
Remember to close this Stream after the iteration is done if required .
629
public static String removePattern ( final String source , final String regex ) { return replacePattern ( source , regex , N . EMPTY_STRING ) ; }
Removes each substring of the source String that matches the given regular expression using the DOTALL option .
630
static long fingerprint ( byte [ ] bytes , int offset , int length ) { if ( length <= 32 ) { if ( length <= 16 ) { return hashLength0to16 ( bytes , offset , length ) ; } else { return hashLength17to32 ( bytes , offset , length ) ; } } else if ( length <= 64 ) { return hashLength33To64 ( bytes , offset , length ) ; } el...
End of public functions .
631
public DBSequence getDBSequence ( final String tableName , final String seqName , final long startVal , final int seqBufferSize ) { return new DBSequence ( this , tableName , seqName , startVal , seqBufferSize ) ; }
Supports global sequence by db table .
632
public void close ( ) throws IOException { try { if ( _ds != null && _ds . isClosed ( ) == false ) { _ds . close ( ) ; } } finally { if ( _dsm != null && _dsm . isClosed ( ) == false ) { _dsm . close ( ) ; } } }
Close the underline data source
633
protected void evict ( ) { lock . lock ( ) ; Map < K , E > removingObjects = null ; try { for ( Map . Entry < K , E > entry : pool . entrySet ( ) ) { if ( entry . getValue ( ) . activityPrint ( ) . isExpired ( ) ) { if ( removingObjects == null ) { removingObjects = Objectory . createMap ( ) ; } removingObjects . put (...
scan the object pool to find the idle object which inactive time greater than permitted the inactive time for it or it s time out .
634
public static Map < String , AttributeValue > asItem ( Object ... a ) { if ( 0 != ( a . length % 2 ) ) { throw new IllegalArgumentException ( "The parameters must be the pairs of property name and value, or Map, or an entity class with getter/setter methods." ) ; } final Map < String , AttributeValue > item = new Linke...
May misused with toItem
635
public static Map < String , AttributeValueUpdate > asUpdateItem ( Object ... a ) { if ( 0 != ( a . length % 2 ) ) { throw new IllegalArgumentException ( "The parameters must be the pairs of property name and value, or Map, or an entity class with getter/setter methods." ) ; } final Map < String , AttributeValueUpdate ...
May misused with toUpdateItem
636
public static Map < String , AttributeValueUpdate > toUpdateItem ( final Object entity ) { return toUpdateItem ( entity , NamingPolicy . LOWER_CAMEL_CASE ) ; }
Only the dirty properties will be set to the result Map if the specified entity is a dirty marker entity .
637
public void moveRow ( Object rowKey , int newRowIndex ) { checkFrozen ( ) ; this . checkRowIndex ( newRowIndex ) ; final int rowIndex = this . getRowIndex ( rowKey ) ; final List < R > tmp = new ArrayList < > ( rowLength ( ) ) ; tmp . addAll ( _rowKeySet ) ; tmp . add ( newRowIndex , tmp . remove ( rowIndex ) ) ; _rowK...
Move the specified row to the new position .
638
public void swapRows ( Object rowKeyA , Object rowKeyB ) { checkFrozen ( ) ; final int rowIndexA = this . getRowIndex ( rowKeyA ) ; final int rowIndexB = this . getRowIndex ( rowKeyB ) ; final List < R > tmp = new ArrayList < > ( rowLength ( ) ) ; tmp . addAll ( _rowKeySet ) ; final R tmpRowKeyA = tmp . get ( rowIndexA...
Swap the positions of the two specified rows .
639
public void moveColumn ( Object columnKey , int newColumnIndex ) { checkFrozen ( ) ; this . checkColumnIndex ( newColumnIndex ) ; final int columnIndex = this . getColumnIndex ( columnKey ) ; final List < C > tmp = new ArrayList < > ( columnLength ( ) ) ; tmp . addAll ( _columnKeySet ) ; tmp . add ( newColumnIndex , tm...
Move the specified column to the new position .
640
public void swapColumns ( Object columnKeyA , Object columnKeyB ) { checkFrozen ( ) ; final int columnIndexA = this . getColumnIndex ( columnKeyA ) ; final int columnIndexB = this . getColumnIndex ( columnKeyB ) ; final List < C > tmp = new ArrayList < > ( rowLength ( ) ) ; tmp . addAll ( _columnKeySet ) ; final C tmpC...
Swap the positions of the two specified columns .
641
private static int mulPosAndCheck ( final int x , final int y ) { final long m = ( long ) x * ( long ) y ; if ( m > Integer . MAX_VALUE ) { throw new ArithmeticException ( "overflow: mulPos" ) ; } return ( int ) m ; }
Multiply two non - negative integers checking for overflow .
642
private static int addAndCheck ( final int x , final int y ) { final long s = ( long ) x + ( long ) y ; if ( s < Integer . MIN_VALUE || s > Integer . MAX_VALUE ) { throw new ArithmeticException ( "overflow: add" ) ; } return ( int ) s ; }
Add two integers checking for overflow .
643
private static int subAndCheck ( final int x , final int y ) { final long s = ( long ) x - ( long ) y ; if ( s < Integer . MIN_VALUE || s > Integer . MAX_VALUE ) { throw new ArithmeticException ( "overflow: add" ) ; } return ( int ) s ; }
Subtract two integers checking for overflow .
644
public int binarySearch ( final int fromIndex , final int toIndex , final int key ) { checkFromToIndex ( fromIndex , toIndex ) ; return N . binarySearch ( elementData , fromIndex , toIndex , key ) ; }
This List should be sorted first .
645
public static < K , V > boolean remove ( final Map < K , V > map , Map . Entry < ? , ? > entry ) { return remove ( map , entry . getKey ( ) , entry . getValue ( ) ) ; }
Removes the specified entry .
646
public static double asinh ( double a ) { boolean negative = false ; if ( a < 0 ) { negative = true ; a = - a ; } double absAsinh ; if ( a > 0.167 ) { absAsinh = Math . log ( Math . sqrt ( a * a + 1 ) + a ) ; } else { final double a2 = a * a ; if ( a > 0.097 ) { absAsinh = a * ( 1 - a2 * ( F_1_3 - a2 * ( F_1_5 - a2 * (...
Compute the inverse hyperbolic sine of a number .
647
public static double atanh ( double a ) { boolean negative = false ; if ( a < 0 ) { negative = true ; a = - a ; } double absAtanh ; if ( a > 0.15 ) { absAtanh = 0.5 * Math . log ( ( 1 + a ) / ( 1 - a ) ) ; } else { final double a2 = a * a ; if ( a > 0.087 ) { absAtanh = a * ( 1 + a2 * ( F_1_3 + a2 * ( F_1_5 + a2 * ( F_...
Compute the inverse hyperbolic tangent of a number .
648
public Statement createStatement ( int resultSetType , int resultSetConcurrency ) throws SQLException { return internalConn . createStatement ( resultSetType , resultSetConcurrency ) ; }
Method createStatement .
649
public boolean isClosed ( ) throws SQLException { if ( ! isClosed ) { try { if ( internalConn . isClosed ( ) ) { destroy ( ) ; } } catch ( SQLException e ) { destroy ( ) ; if ( logger . isWarnEnabled ( ) ) { logger . warn ( AbacusException . getErrorMsg ( e ) ) ; } } } return isClosed ; }
Method isClosed .
650
public void setTypeMap ( Map < String , Class < ? > > arg0 ) throws SQLException { internalConn . setTypeMap ( arg0 ) ; }
Method setTypeMap .
651
public void setClientInfo ( String name , String value ) throws SQLClientInfoException { internalConn . setClientInfo ( name , value ) ; }
Method setClientInfo .
652
public AnyDelete addFamilyVersion ( String family , final long timestamp ) { delete . addFamilyVersion ( toFamilyQualifierBytes ( family ) , timestamp ) ; return this ; }
Delete all columns of the specified family with a timestamp equal to the specified timestamp .
653
public AnyDelete addColumn ( String family , String qualifier ) { delete . addColumn ( toFamilyQualifierBytes ( family ) , toFamilyQualifierBytes ( qualifier ) ) ; return this ; }
Delete the latest version of the specified column . This is an expensive call in that on the server - side it first does a get to find the latest versions timestamp . Then it adds a delete using the fetched cells timestamp .
654
public AnyDelete addColumns ( String family , String qualifier ) { delete . addColumns ( toFamilyQualifierBytes ( family ) , toFamilyQualifierBytes ( qualifier ) ) ; return this ; }
Delete all versions of the specified column .
655
public Triple < R , M , L > reversed ( ) { return new Triple < > ( this . right , this . middle , this . left ) ; }
Returns a new instance of Triple&lt ; R M L&gt ; .
656
long freeSpaceWindows ( String path , final long timeout ) throws IOException { path = FilenameUtil . normalize ( path , false ) ; if ( path . length ( ) > 0 && path . charAt ( 0 ) != '"' ) { path = "\"" + path + "\"" ; } final String [ ] cmdAttribs = new String [ ] { "cmd.exe" , "/C" , "dir /a /-c " + path } ; final L...
Find free space on the Windows platform using the dir command .
657
long parseDir ( final String line , final String path ) throws IOException { int bytesStart = 0 ; int bytesEnd = 0 ; int j = line . length ( ) - 1 ; innerLoop1 : while ( j >= 0 ) { final char c = line . charAt ( j ) ; if ( Character . isDigit ( c ) ) { bytesEnd = j + 1 ; break innerLoop1 ; } j -- ; } innerLoop2 : while...
Parses the Windows dir response last line
658
long parseBytes ( final String freeSpace , final String path ) throws IOException { try { final long bytes = Long . parseLong ( freeSpace ) ; if ( bytes < 0 ) { throw new IOException ( "Command line '" + DF + "' did not find free space in response " + "for path '" + path + "'- check path is valid" ) ; } return bytes ; ...
Parses the bytes from a string .
659
List < String > performCommand ( final String [ ] cmdAttribs , final int max , final long timeout ) throws IOException { final List < String > lines = new ArrayList < String > ( 20 ) ; Process proc = null ; InputStream in = null ; OutputStream out = null ; InputStream err = null ; BufferedReader inr = null ; try { fina...
Performs the os command .
660
public Set < Map . Entry < K , V > > entrySet ( ) { return new AbstractSet < Map . Entry < K , V > > ( ) { public Iterator < Map . Entry < K , V > > iterator ( ) { return new ObjIterator < Map . Entry < K , V > > ( ) { private final Iterator < Map . Entry < K , V > > keyValueEntryIter = keyMap . entrySet ( ) . iterator...
Returns an immutable Set of Immutable entry .
661
public BiMap < V , K > inversed ( ) { return ( inverse == null ) ? inverse = new BiMap < > ( valueMap , keyMap ) : inverse ; }
Returns the inverse view of this BiMap which maps each of this bimap s values to its associated key . The two BiMaps are backed by the same data ; any changes to one will appear in the other .
662
protected void evict ( ) { for ( int i = 0 , len = _segments . length ; i < len ; i ++ ) { if ( _segments [ i ] . blockBitSet . isEmpty ( ) ) { final Deque < Segment > queue = _segmentQueueMap . get ( i ) ; if ( queue != null ) { synchronized ( queue ) { if ( _segments [ i ] . blockBitSet . isEmpty ( ) ) { synchronized...
recycle the empty Segment .
663
private void log ( String callerFQCN , Level level , String msg , Throwable t ) { LogRecord record = new LogRecord ( level , msg ) ; record . setLoggerName ( getName ( ) ) ; record . setThrown ( t ) ; fillCallerData ( callerFQCN , record ) ; loggerImpl . log ( record ) ; }
Log the message at the specified level with the specified throwable if any . This method creates a LogRecord and fills in caller date before calling this instance s JDK14 logger .
664
final private void fillCallerData ( String callerFQCN , LogRecord record ) { StackTraceElement [ ] steArray = new Throwable ( ) . getStackTrace ( ) ; int selfIndex = - 1 ; for ( int i = 0 ; i < steArray . length ; i ++ ) { final String className = steArray [ i ] . getClassName ( ) ; if ( className . equals ( callerFQCN...
Fill in caller data if possible .
665
public boolean removeAll ( final Collection < ? > c , final long occurrences ) { checkOccurrences ( occurrences ) ; if ( N . isNullOrEmpty ( c ) || occurrences == 0 ) { return false ; } boolean result = false ; for ( Object e : c ) { if ( result == false ) { result = remove ( e , occurrences ) ; } else { remove ( e , o...
Remove the specified occurrences from the specified elements . The elements will be removed from this set if the occurrences equals to or less than 0 after the operation .
666
public static < T > T newInstance ( final Class < T > cls ) { if ( Modifier . isAbstract ( cls . getModifiers ( ) ) ) { if ( cls . equals ( Map . class ) ) { return ( T ) new HashMap < > ( ) ; } else if ( cls . equals ( List . class ) ) { return ( T ) new ArrayList < > ( ) ; } else if ( cls . equals ( Set . class ) ) {...
Method newInstance .
667
@ SuppressWarnings ( "unchecked" ) public static < T > T newArray ( final Class < ? > componentType , final int length ) { return ( T ) Array . newInstance ( componentType , length ) ; }
Method newArray .
668
public static < E > Set < E > newSetFromMap ( final Map < E , Boolean > map ) { return Collections . newSetFromMap ( map ) ; }
Returns a set backed by the specified map .
669
@ SuppressWarnings ( "unchecked" ) public static Object [ ] toArray ( final Collection < ? > c ) { if ( N . isNullOrEmpty ( c ) ) { return N . EMPTY_OBJECT_ARRAY ; } return c . toArray ( new Object [ c . size ( ) ] ) ; }
Returns an empty array if the specified collection is null or empty .
670
public static int deepHashCode ( final Object obj ) { if ( obj == null ) { return 0 ; } if ( obj . getClass ( ) . isArray ( ) ) { return typeOf ( obj . getClass ( ) ) . deepHashCode ( obj ) ; } return obj . hashCode ( ) ; }
Method deepHashCode .
671
public static String deepToString ( final Object obj ) { if ( obj == null ) { return NULL_STRING ; } if ( obj . getClass ( ) . isArray ( ) ) { return typeOf ( obj . getClass ( ) ) . deepToString ( obj ) ; } return obj . toString ( ) ; }
Method deepToString .
672
public static < T > List < T > repeatEach ( final Collection < T > c , final int n ) { N . checkArgNotNegative ( n , "n" ) ; if ( n == 0 || isNullOrEmpty ( c ) ) { return new ArrayList < T > ( ) ; } final List < T > result = new ArrayList < > ( c . size ( ) * n ) ; for ( T e : c ) { for ( int i = 0 ; i < n ; i ++ ) { r...
Repeats the elements in the specified Collection one by one .
673
public static < T > List < T > repeatEachToSize ( final Collection < T > c , final int size ) { N . checkArgNotNegative ( size , "size" ) ; checkArgument ( size == 0 || notNullOrEmpty ( c ) , "Collection can not be empty or null when size > 0" ) ; if ( size == 0 || isNullOrEmpty ( c ) ) { return new ArrayList < T > ( )...
Repeats the elements in the specified Collection one by one till reach the specified size .
674
public static < T > T max ( final Collection < ? extends T > c , final int from , final int to , Comparator < ? super T > cmp ) { checkFromToIndex ( from , to , size ( c ) ) ; if ( N . isNullOrEmpty ( c ) || to - from < 1 || from >= c . size ( ) ) { throw new IllegalArgumentException ( "The size of collection can not b...
Returns the maximum element in the collection .
675
private synchronized PoolableConnection newConnection ( ) { synchronized ( xpool ) { if ( xpool . size ( ) >= maxActive ) { return null ; } try { PoolableConnection conn = null ; if ( xpool . size ( ) < minIdle ) { conn = new PoolableConnection ( this , ds . getConnection ( ) , liveTime , Integer . MAX_VALUE , maxOpenP...
Method newConnection .
676
private void initPool ( ) { if ( logger . isWarnEnabled ( ) ) { logger . warn ( "Start to initialize connection pool with url: " + url + " ..." ) ; } for ( int i = 0 ; ( i < initialSize ) && ( xpool . size ( ) < initialSize ) ; i ++ ) { pool . lock ( ) ; try { if ( pool . isClosed ( ) ) { break ; } if ( ( i < initialSi...
Method initPool .
677
public static void registerXMLBindingClassForPropGetSetMethod ( final Class < ? > cls ) { if ( registeredXMLBindingClassList . containsKey ( cls ) ) { return ; } synchronized ( entityDeclaredPropGetMethodPool ) { registeredXMLBindingClassList . put ( cls , false ) ; if ( entityDeclaredPropGetMethodPool . containsKey ( ...
The property maybe only has get method if its type is collection or map by xml binding specificatio Otherwise it will be ignored if not registered by calling this method .
678
public static Set < Class < ? > > getAllInterfaces ( final Class < ? > cls ) { final Set < Class < ? > > interfacesFound = new LinkedHashSet < > ( ) ; getAllInterfaces ( cls , interfacesFound ) ; return interfacesFound ; }
Copied from Apache Commons Lang under Apache License v2 .
679
public static List < String > getPropNameList ( final Class < ? > cls ) { List < String > propNameList = entityDeclaredPropNameListPool . get ( cls ) ; if ( propNameList == null ) { loadPropGetSetMethodList ( cls ) ; propNameList = entityDeclaredPropNameListPool . get ( cls ) ; } return propNameList ; }
Returns an immutable entity property name List by the specified class .
680
public int totalCountOfValues ( ) { int count = 0 ; for ( V v : valueMap . values ( ) ) { count += v . size ( ) ; } return count ; }
Returns the total count of all the elements in all values .
681
public static long skip ( final InputStream input , final long toSkip ) throws UncheckedIOException { if ( toSkip < 0 ) { throw new IllegalArgumentException ( "Skip count must be non-negative, actual: " + toSkip ) ; } else if ( toSkip == 0 ) { return 0 ; } final byte [ ] buf = Objectory . createByteArrayBuffer ( ) ; lo...
Return the count of skipped bytes .
682
private static long estimateLineCount ( final File file , final int byReadingLineNum ) throws UncheckedIOException { final Holder < ZipFile > outputZipFile = new Holder < > ( ) ; InputStream is = null ; BufferedReader br = null ; try { is = openFile ( outputZipFile , file ) ; br = Objectory . createBufferedReader ( is ...
Estimate the total line count of the file by reading the specified line count ahead .
683
public static long merge ( final Collection < File > sourceFiles , final File destFile ) throws UncheckedIOException { final byte [ ] buf = Objectory . createByteArrayBuffer ( ) ; long totalCount = 0 ; OutputStream output = null ; try { output = new FileOutputStream ( destFile ) ; InputStream input = null ; for ( File ...
Merge the specified source files into the destination file .
684
private static String decodeUrl ( final String url ) { String decoded = url ; if ( url != null && url . indexOf ( '%' ) >= 0 ) { final int n = url . length ( ) ; final StringBuffer buffer = new StringBuffer ( ) ; final ByteBuffer bytes = ByteBuffer . allocate ( n ) ; for ( int i = 0 ; i < n ; ) { if ( url . charAt ( i ...
unavoidable until Java 7
685
public static < R > Stream < R > zip ( final ShortStream a , final ShortStream b , final ShortBiFunction < R > zipFunction ) { return zip ( a . iteratorEx ( ) , b . iteratorEx ( ) , zipFunction ) . onClose ( newCloseHandler ( N . asList ( a , b ) ) ) ; }
Zip together the a and b streams until one of them runs out of values . Each pair of values is combined into a single value using the supplied zipFunction function .
686
static URLSpec getReleaseDownloadUrl ( String path , MavenSettings settings ) throws IOException { String url = settings . mCentralUrl ; if ( settings . mMirrorUrl != null ) url = settings . mMirrorUrl ; return new URLSpec ( url + path , settings . mProxyHost , settings . mProxyPort ) ; }
get release download URL
687
static URLSpec getSnapshotDownloadUrl ( String path , MavenSettings settings ) throws IOException { String url = settings . mSnapshotUrl ; return new URLSpec ( url + path , settings . mProxyHost , settings . mProxyPort ) ; }
get snapshot download URL
688
static MavenSettings getMavenSettings ( ) { try { String homeDir = System . getProperty ( "user.home" ) ; return parseMavenSettings ( new File ( homeDir , ".m2/settings.xml" ) ) ; } catch ( Exception e ) { log ( e ) ; } return new MavenSettings ( ) ; }
get maven settings
689
static MavenSettings parseMavenSettings ( File settingsFile ) throws IOException { MavenSettings settings = new MavenSettings ( ) ; try { DocumentBuilder xmlBuilder = DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) ; Document xmlDoc = xmlBuilder . parse ( settingsFile ) ; NodeList mirrorList = xmlDoc ...
parse maven settings . xml
690
static String parseSnapshotExeName ( File mdFile ) throws IOException { String exeName = null ; try { String clsStr = Protoc . getPlatformClassifier ( ) ; DocumentBuilder xmlBuilder = DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) ; Document xmlDoc = xmlBuilder . parse ( mdFile ) ; NodeList versions ...
parse snapshot exe name from maven - metadata . xml
691
public static void assertSelectCount ( long expectedSelectCount ) { QueryCount queryCount = QueryCountHolder . getGrandTotal ( ) ; long recordedSelectCount = queryCount . getSelect ( ) ; if ( expectedSelectCount != recordedSelectCount ) { throw new SQLSelectCountMismatchException ( expectedSelectCount , recordedSelectC...
Assert select statement count
692
public static void assertInsertCount ( long expectedInsertCount ) { QueryCount queryCount = QueryCountHolder . getGrandTotal ( ) ; long recordedInsertCount = queryCount . getInsert ( ) ; if ( expectedInsertCount != recordedInsertCount ) { throw new SQLInsertCountMismatchException ( expectedInsertCount , recordedInsertC...
Assert insert statement count
693
public static void assertUpdateCount ( long expectedUpdateCount ) { QueryCount queryCount = QueryCountHolder . getGrandTotal ( ) ; long recordedUpdateCount = queryCount . getUpdate ( ) ; if ( expectedUpdateCount != recordedUpdateCount ) { throw new SQLUpdateCountMismatchException ( expectedUpdateCount , recordedUpdateC...
Assert update statement count
694
public static void assertDeleteCount ( long expectedDeleteCount ) { QueryCount queryCount = QueryCountHolder . getGrandTotal ( ) ; long recordedDeleteCount = queryCount . getDelete ( ) ; if ( expectedDeleteCount != recordedDeleteCount ) { throw new SQLDeleteCountMismatchException ( expectedDeleteCount , recordedDeleteC...
Assert delete statement count
695
public void login ( String username , String passwd , String domain ) { this . login = getPerformedAction ( new PostLogin ( username , passwd , domain ) ) . getLoginData ( ) ; loginChangeUserInfo = true ; if ( getVersion ( ) == Version . UNKNOWN ) { loginChangeVersion = true ; } }
Performs a Login .
696
public void delete ( String title , String reason ) { getPerformedAction ( new PostDelete ( getUserinfo ( ) , title , reason ) ) ; }
deletes an article with a reason
697
private EditType getEditType ( String typeName ) { for ( EditType type : EditType . values ( ) ) { if ( type . toString ( ) . equals ( typeName ) ) { return type ; } } return null ; }
Create a EditType from the name type used by MW
698
protected ImmutableList < String > parseElements ( String s ) { ImmutableList . Builder < String > titles = ImmutableList . builder ( ) ; Optional < XmlElement > child = XmlConverter . getChildOpt ( s , "query" , "allpages" ) ; if ( child . isPresent ( ) ) { for ( XmlElement pageElement : child . get ( ) . getChildren ...
Picks the article name from a MediaWiki api response .
699
static Optional < XmlElement > getErrorElement ( XmlElement rootXmlElement ) { Optional < XmlElement > elem = rootXmlElement . getChildOpt ( "error" ) ; if ( elem . isPresent ( ) ) { ApiException error = elem . transform ( toApiException ( ) ) . get ( ) ; log . error ( error . getCode ( ) + ": " + error . getValue ( ) ...
Determines if the given XML Document contains an error message which then would printed by the logger .