idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
156,500
public void record ( ByteBuffer block , int offset ) { if ( this . data == null ) { this . data = ByteBuffer . allocate ( ( int ) this . length ) ; } int pos = block . position ( ) ; this . data . position ( offset ) ; this . data . put ( block ) ; block . position ( pos ) ; }
Record the given block at the given offset in this piece .
156,501
public int compareTo ( Piece other ) { if ( this . equals ( other ) ) { return 0 ; } else if ( this . seen == other . seen ) { return new Integer ( this . index ) . compareTo ( other . index ) ; } else if ( this . seen < other . seen ) { return - 1 ; } else { return 1 ; } }
Piece comparison function for ordering pieces based on their availability .
156,502
public void addPeer ( TrackedPeer peer ) { this . peers . put ( new PeerUID ( peer . getAddress ( ) , this . getHexInfoHash ( ) ) , peer ) ; }
Add a peer exchanging on this torrent .
156,503
public List < Peer > getSomePeers ( Peer peer ) { List < Peer > peers = new LinkedList < Peer > ( ) ; List < TrackedPeer > candidates = new LinkedList < TrackedPeer > ( this . peers . values ( ) ) ; Collections . shuffle ( candidates ) ; int count = 0 ; for ( TrackedPeer candidate : candidates ) { if ( peer != null && ...
Get a list of peers we can return in an announce response for this torrent .
156,504
public static TrackedTorrent load ( File torrent ) throws IOException { TorrentMetadata torrentMetadata = new TorrentParser ( ) . parseFromFile ( torrent ) ; return new TrackedTorrent ( torrentMetadata . getInfoHash ( ) ) ; }
Load a tracked torrent from the given torrent file .
156,505
public TorrentManager addTorrent ( String dotTorrentFilePath , String downloadDirPath ) throws IOException { return addTorrent ( dotTorrentFilePath , downloadDirPath , FairPieceStorageFactory . INSTANCE ) ; }
Adds torrent to storage validate downloaded files and start seeding and leeching the torrent
156,506
public TorrentManager addTorrent ( String dotTorrentFilePath , String downloadDirPath , List < TorrentListener > listeners ) throws IOException { return addTorrent ( dotTorrentFilePath , downloadDirPath , FairPieceStorageFactory . INSTANCE , listeners ) ; }
Adds torrent to storage with specified listeners validate downloaded files and start seeding and leeching the torrent
156,507
public TorrentManager addTorrent ( TorrentMetadataProvider metadataProvider , PieceStorage pieceStorage ) throws IOException { return addTorrent ( metadataProvider , pieceStorage , Collections . < TorrentListener > emptyList ( ) ) ; }
Adds torrent to storage with any storage and metadata source
156,508
public TorrentManager addTorrent ( TorrentMetadataProvider metadataProvider , PieceStorage pieceStorage , List < TorrentListener > listeners ) throws IOException { TorrentMetadata torrentMetadata = metadataProvider . getTorrentMetadata ( ) ; EventDispatcher eventDispatcher = new EventDispatcher ( ) ; for ( TorrentListe...
Adds torrent to storage with any storage metadata source and specified listeners
156,509
public void removeTorrent ( String torrentHash ) { logger . debug ( "Stopping seeding " + torrentHash ) ; final Pair < SharedTorrent , LoadedTorrent > torrents = torrentsStorage . remove ( torrentHash ) ; SharedTorrent torrent = torrents . first ( ) ; if ( torrent != null ) { torrent . setClientState ( ClientState . DO...
Removes specified torrent from storage .
156,510
public boolean isSeed ( String hexInfoHash ) { SharedTorrent t = this . torrentsStorage . getTorrent ( hexInfoHash ) ; return t != null && t . isComplete ( ) ; }
Tells whether we are a seed for the torrent we re sharing .
156,511
public void handleAnnounceResponse ( int interval , int complete , int incomplete , String hexInfoHash ) { final SharedTorrent sharedTorrent = this . torrentsStorage . getTorrent ( hexInfoHash ) ; if ( sharedTorrent != null ) { sharedTorrent . setSeedersCount ( complete ) ; sharedTorrent . setLastAnnounceTime ( System ...
Handle an announce response event .
156,512
public void handleDiscoveredPeers ( List < Peer > peers , String hexInfoHash ) { if ( peers . size ( ) == 0 ) return ; SharedTorrent torrent = torrentsStorage . getTorrent ( hexInfoHash ) ; if ( torrent != null && torrent . isFinished ( ) ) return ; final LoadedTorrent announceableTorrent = torrentsStorage . getLoadedT...
Handle the discovery of new peers .
156,513
public static String byteArrayToHexString ( byte [ ] bytes ) { char [ ] hexChars = new char [ bytes . length * 2 ] ; for ( int j = 0 ; j < bytes . length ; j ++ ) { int v = bytes [ j ] & 0xFF ; hexChars [ j * 2 ] = HEX_SYMBOLS [ v >>> 4 ] ; hexChars [ j * 2 + 1 ] = HEX_SYMBOLS [ v & 0x0F ] ; } return new String ( hexCh...
Convert a byte string to a string containing an hexadecimal representation of the original data .
156,514
@ ConditionalOnMissingBean ( ZookeeperHealthIndicator . class ) @ ConditionalOnBean ( CuratorFramework . class ) @ ConditionalOnEnabledHealthIndicator ( "zookeeper" ) public ZookeeperHealthIndicator zookeeperHealthIndicator ( CuratorFramework curator ) { return new ZookeeperHealthIndicator ( curator ) ; }
If there is an active curator if the zookeeper health endpoint is enabled and if a health indicator hasn t already been added by a user add one .
156,515
private void createProxies ( ) { source = createProxy ( sourceType ) ; destination = createProxy ( destinationType ) ; for ( VisitedMapping mapping : visitedMappings ) { createAccessorProxies ( source , mapping . sourceAccessors ) ; createAccessorProxies ( destination , mapping . destinationAccessors ) ; } }
Creates the source and destination proxy models .
156,516
private void validateRecordedMapping ( ) { if ( currentMapping . destinationMutators == null || currentMapping . destinationMutators . isEmpty ( ) ) errors . missingDestination ( ) ; else if ( options . skipType == 0 && ( currentMapping . sourceAccessors == null || currentMapping . sourceAccessors . isEmpty ( ) ) && cu...
Validates the current mapping that was recorded via a MapExpression .
156,517
@ SuppressWarnings ( "unchecked" ) static < T > TypeInfoImpl < T > typeInfoFor ( Class < T > sourceType , InheritingConfiguration configuration ) { TypeInfoKey pair = new TypeInfoKey ( sourceType , configuration ) ; TypeInfoImpl < T > typeInfo = ( TypeInfoImpl < T > ) cache . get ( pair ) ; if ( typeInfo == null ) { sy...
Returns a statically cached TypeInfoImpl instance for the given criteria .
156,518
public static boolean mightContainsProperties ( Class < ? > type ) { return type != Object . class && type != String . class && type != Date . class && type != Calendar . class && ! Primitives . isPrimitive ( type ) && ! Iterables . isIterable ( type ) && ! Types . isGroovyType ( type ) ; }
Returns whether the type might contains properties or not .
156,519
private void mergeMappings ( TypeMap < ? , ? > destinationMap ) { for ( Mapping mapping : destinationMap . getMappings ( ) ) { InternalMapping internalMapping = ( InternalMapping ) mapping ; mergedMappings . add ( internalMapping . createMergedCopy ( propertyNameInfo . getSourceProperties ( ) , propertyNameInfo . getDe...
Merges mappings from an existing TypeMap into the type map under construction .
156,520
private boolean isConvertable ( Mapping mapping ) { if ( mapping == null || mapping . getProvider ( ) != null || ! ( mapping instanceof PropertyMapping ) ) return false ; PropertyMapping propertyMapping = ( PropertyMapping ) mapping ; boolean hasSupportConverter = converterStore . getFirstSupported ( propertyMapping . ...
Indicates whether the mapping represents a PropertyMapping that is convertible to the destination type .
156,521
static void mapAutomatically ( ) { Order order = createOrder ( ) ; ModelMapper modelMapper = new ModelMapper ( ) ; OrderDTO orderDTO = modelMapper . map ( order , OrderDTO . class ) ; assertOrdersEqual ( order , orderDTO ) ; }
This example demonstrates how ModelMapper automatically maps properties from Order to OrderDTO .
156,522
static void mapExplicitly ( ) { Order order = createOrder ( ) ; ModelMapper modelMapper = new ModelMapper ( ) ; modelMapper . addMappings ( new PropertyMap < Order , OrderDTO > ( ) { protected void configure ( ) { map ( ) . setBillingStreet ( source . getBillingAddress ( ) . getStreet ( ) ) ; map ( source . billingAddr...
This example demonstrates how ModelMapper can be used to explicitly map properties from an Order to OrderDTO .
156,523
public static < T > Collection < T > createCollection ( MappingContext < ? , Collection < T > > context ) { if ( context . getDestinationType ( ) . isInterface ( ) ) if ( SortedSet . class . isAssignableFrom ( context . getDestinationType ( ) ) ) return new TreeSet < T > ( ) ; else if ( Set . class . isAssignableFrom (...
Creates a collection based on the destination type .
156,524
public static String format ( String heading , Collection < ErrorMessage > errorMessages ) { @ SuppressWarnings ( "resource" ) Formatter fmt = new Formatter ( ) . format ( heading ) . format ( ":%n%n" ) ; int index = 1 ; boolean displayCauses = getOnlyCause ( errorMessages ) == null ; for ( ErrorMessage errorMessage : ...
Returns the formatted message for an exception with the specified messages .
156,525
public Map < String , Accessor > getAccessors ( ) { if ( accessors == null ) synchronized ( this ) { if ( accessors == null ) accessors = PropertyInfoSetResolver . resolveAccessors ( source , type , configuration ) ; } return accessors ; }
Lazily initializes and gets accessors .
156,526
public Map < String , Mutator > getMutators ( ) { if ( mutators == null ) synchronized ( this ) { if ( mutators == null ) mutators = PropertyInfoSetResolver . resolveMutators ( type , configuration ) ; } return mutators ; }
Lazily initializes and gets mutators .
156,527
static synchronized Accessor accessorFor ( Class < ? > type , Method method , Configuration configuration , String name ) { PropertyInfoKey key = new PropertyInfoKey ( type , name , configuration ) ; Accessor accessor = ACCESSOR_CACHE . get ( key ) ; if ( accessor == null ) { accessor = new MethodAccessor ( type , meth...
Returns an Accessor for the given accessor method . The method must be externally validated to ensure that it accepts zero arguments and does not return void . class .
156,528
static synchronized FieldPropertyInfo fieldPropertyFor ( Class < ? > type , Field field , Configuration configuration , String name ) { PropertyInfoKey key = new PropertyInfoKey ( type , name , configuration ) ; FieldPropertyInfo fieldPropertyInfo = FIELD_CACHE . get ( key ) ; if ( fieldPropertyInfo == null ) { fieldPr...
Returns a FieldPropertyInfo instance for the given field .
156,529
static synchronized Mutator mutatorFor ( Class < ? > type , Method method , Configuration configuration , String name ) { PropertyInfoKey key = new PropertyInfoKey ( type , name , configuration ) ; Mutator mutator = MUTATOR_CACHE . get ( key ) ; if ( mutator == null ) { mutator = new MethodMutator ( type , method , nam...
Returns a Mutator instance for the given mutator method . The method must be externally validated to ensure that it accepts one argument and returns void . class .
156,530
@ SuppressWarnings ( "unchecked" ) public static int getLength ( Object iterable ) { Assert . state ( isIterable ( iterable . getClass ( ) ) ) ; return iterable . getClass ( ) . isArray ( ) ? Array . getLength ( iterable ) : ( ( Collection < Object > ) iterable ) . size ( ) ; }
Gets the length of an iterable .
156,531
@ SuppressWarnings ( "unchecked" ) public static Iterator < Object > iterator ( Object iterable ) { Assert . state ( isIterable ( iterable . getClass ( ) ) ) ; return iterable . getClass ( ) . isArray ( ) ? new ArrayIterator ( iterable ) : ( ( Iterable < Object > ) iterable ) . iterator ( ) ; }
Creates a iterator from given iterable .
156,532
@ SuppressWarnings ( "unchecked" ) public static Object getElement ( Object iterable , int index ) { if ( iterable . getClass ( ) . isArray ( ) ) return getElementFromArrary ( iterable , index ) ; if ( iterable instanceof Collection ) return getElementFromCollection ( ( Collection < Object > ) iterable , index ) ; retu...
Gets the element from an iterable with given index .
156,533
public static Object getElementFromArrary ( Object array , int index ) { try { return Array . get ( array , index ) ; } catch ( ArrayIndexOutOfBoundsException e ) { return null ; } }
Gets the element from an array with given index .
156,534
public static Object getElementFromCollection ( Collection < Object > collection , int index ) { if ( collection . size ( ) < index + 1 ) return null ; if ( collection instanceof List ) return ( ( List < Object > ) collection ) . get ( index ) ; Iterator < Object > iterator = collection . iterator ( ) ; for ( int i = 0...
Gets the element from a collection with given index .
156,535
public synchronized String version ( ) throws IOException { if ( this . version == null ) { Process p = runFunc . run ( ImmutableList . of ( path , "-version" ) ) ; try { BufferedReader r = wrapInReader ( p ) ; this . version = r . readLine ( ) ; CharStreams . copy ( r , CharStreams . nullWriter ( ) ) ; throwOnError ( ...
Returns the version string for this binary .
156,536
public List < String > path ( List < String > args ) throws IOException { return ImmutableList . < String > builder ( ) . add ( path ) . addAll ( args ) . build ( ) ; }
Returns the full path to the binary with arguments appended .
156,537
public static URI checkValidStream ( URI uri ) throws IllegalArgumentException { String scheme = checkNotNull ( uri ) . getScheme ( ) ; scheme = checkNotNull ( scheme , "URI is missing a scheme" ) . toLowerCase ( ) ; if ( rtps . contains ( scheme ) ) { return uri ; } if ( udpTcp . contains ( scheme ) ) { if ( uri . get...
Checks if the URI is valid for streaming to .
156,538
public void read ( NutDataInputStream in , long startcode ) throws IOException { this . startcode = startcode ; forwardPtr = in . readVarLong ( ) ; if ( forwardPtr > 4096 ) { long expected = in . getCRC ( ) ; checksum = in . readInt ( ) ; if ( checksum != expected ) { throw new IOException ( String . format ( "invalid ...
End byte of packet
156,539
public EncodingOptions buildOptions ( ) { return new EncodingOptions ( new MainEncodingOptions ( format , startOffset , duration ) , new AudioEncodingOptions ( audio_enabled , audio_codec , audio_channels , audio_sample_rate , audio_sample_format , audio_bit_rate , audio_quality ) , new VideoEncodingOptions ( video_ena...
Returns a representation of this Builder that can be safely serialised .
156,540
protected void readFileId ( ) throws IOException { byte [ ] b = new byte [ HEADER . length ] ; in . readFully ( b ) ; if ( ! Arrays . equals ( b , HEADER ) ) { throw new IOException ( "file_id_string does not match. got: " + new String ( b , Charsets . ISO_8859_1 ) ) ; } }
Read the magic at the beginning of the file .
156,541
protected long readReservedHeaders ( ) throws IOException { long startcode = in . readStartCode ( ) ; while ( Startcode . isPossibleStartcode ( startcode ) && isKnownStartcode ( startcode ) ) { new Packet ( ) . read ( in , startcode ) ; startcode = in . readStartCode ( ) ; } return startcode ; }
Read headers we don t know how to parse yet returning the next startcode .
156,542
public void read ( ) throws IOException { readFileId ( ) ; in . resetCRC ( ) ; long startcode = in . readStartCode ( ) ; while ( true ) { header = new MainHeaderPacket ( ) ; if ( ! Startcode . MAIN . equalsCode ( startcode ) ) { throw new IOException ( String . format ( "expected main header found: 0x%X" , startcode ) ...
Demux the inputstream
156,543
public T setVideoFrameRate ( Fraction frame_rate ) { this . video_enabled = true ; this . video_frame_rate = checkNotNull ( frame_rate ) ; return getThis ( ) ; }
Sets the video s frame rate
156,544
public T addMetaTag ( String key , String value ) { checkValidKey ( key ) ; checkNotEmpty ( value , "value must not be empty" ) ; meta_tags . add ( "-metadata" ) ; meta_tags . add ( key + "=" + value ) ; return getThis ( ) ; }
Add metadata on output streams . Which keys are possible depends on the used codec .
156,545
public T setAudioChannels ( int channels ) { checkArgument ( channels > 0 , "channels must be positive" ) ; this . audio_enabled = true ; this . audio_channels = channels ; return getThis ( ) ; }
Sets the number of audio channels
156,546
public T setAudioSampleRate ( int sample_rate ) { checkArgument ( sample_rate > 0 , "sample rate must be positive" ) ; this . audio_enabled = true ; this . audio_sample_rate = sample_rate ; return getThis ( ) ; }
Sets the Audio sample rate for example 44_000 .
156,547
public T setStartOffset ( long offset , TimeUnit units ) { checkNotNull ( units ) ; this . startOffset = units . toMillis ( offset ) ; return getThis ( ) ; }
Decodes but discards input until the offset .
156,548
public T setDuration ( long duration , TimeUnit units ) { checkNotNull ( units ) ; this . duration = units . toMillis ( duration ) ; return getThis ( ) ; }
Stop writing the output after duration is reached .
156,549
public T setAudioPreset ( String preset ) { this . audio_enabled = true ; this . audio_preset = checkNotEmpty ( preset , "audio preset must not be empty" ) ; return getThis ( ) ; }
Sets a audio preset to use .
156,550
public T setSubtitlePreset ( String preset ) { this . subtitle_enabled = true ; this . subtitle_preset = checkNotEmpty ( preset , "subtitle preset must not be empty" ) ; return getThis ( ) ; }
Sets a subtitle preset to use .
156,551
public int readVarInt ( ) throws IOException { boolean more ; int result = 0 ; do { int b = in . readUnsignedByte ( ) ; more = ( b & 0x80 ) == 0x80 ; result = 128 * result + ( b & 0x7F ) ; } while ( more ) ; return result ; }
Read a simple var int up to 32 bits
156,552
public long readVarLong ( ) throws IOException { boolean more ; long result = 0 ; do { int b = in . readUnsignedByte ( ) ; more = ( b & 0x80 ) == 0x80 ; result = 128 * result + ( b & 0x7F ) ; } while ( more ) ; return result ; }
Read a simple var int up to 64 bits
156,553
public byte [ ] readVarArray ( ) throws IOException { int len = ( int ) readVarLong ( ) ; byte [ ] result = new byte [ len ] ; in . read ( result ) ; return result ; }
Read a array with a varint prefixed length
156,554
public long readStartCode ( ) throws IOException { byte frameCode = in . readByte ( ) ; if ( frameCode != 'N' ) { return ( long ) ( frameCode & 0xff ) ; } byte [ ] buffer = new byte [ 8 ] ; buffer [ 0 ] = frameCode ; readFully ( buffer , 1 , 7 ) ; return ( ( ( long ) buffer [ 0 ] << 56 ) + ( ( long ) ( buffer [ 1 ] & 2...
Returns the start code OR frame_code if the code doesn t start with N
156,555
public static StreamSpecifier stream ( StreamSpecifierType type , int index ) { checkNotNull ( type ) ; return new StreamSpecifier ( type . toString ( ) + ":" + index ) ; }
Matches the stream number stream_index of this type .
156,556
public static StreamSpecifier tag ( String key , String value ) { checkValidKey ( key ) ; checkNotNull ( value ) ; return new StreamSpecifier ( "m:" + key + ":" + value ) ; }
Matches streams with the metadata tag key having the specified value .
156,557
protected boolean parseLine ( String line ) { line = checkNotNull ( line ) . trim ( ) ; if ( line . isEmpty ( ) ) { return false ; } final String [ ] args = line . split ( "=" , 2 ) ; if ( args . length != 2 ) { return false ; } final String key = checkNotNull ( args [ 0 ] ) ; final String value = checkNotNull ( args [...
Parses values from the line into this object .
156,558
static URI createUri ( String scheme , InetAddress address , int port ) throws URISyntaxException { checkNotNull ( address ) ; return new URI ( scheme , null , InetAddresses . toUriString ( address ) , port , null , null , null ) ; }
Creates a URL to parse to FFmpeg based on the scheme address and port .
156,559
public synchronized void start ( ) { if ( thread != null ) { throw new IllegalThreadStateException ( "Parser already started" ) ; } String name = getThreadName ( ) + "(" + getUri ( ) . toString ( ) + ")" ; CountDownLatch startSignal = new CountDownLatch ( 1 ) ; Runnable runnable = getRunnable ( startSignal ) ; thread =...
Starts the ProgressParser waiting for progress .
156,560
public static long parseBitrate ( String bitrate ) { if ( "N/A" . equals ( bitrate ) ) { return - 1 ; } Matcher m = BITRATE_REGEX . matcher ( bitrate ) ; if ( ! m . find ( ) ) { throw new IllegalArgumentException ( "Invalid bitrate '" + bitrate + "'" ) ; } return ( long ) ( Float . parseFloat ( m . group ( 1 ) ) * 1000...
Converts a string representation of bitrate to a long of bits per second
156,561
public static int waitForWithTimeout ( final Process p , long timeout , TimeUnit unit ) throws TimeoutException { ProcessThread t = new ProcessThread ( p ) ; t . start ( ) ; try { unit . timedJoin ( t , timeout ) ; } catch ( InterruptedException e ) { t . interrupt ( ) ; Thread . currentThread ( ) . interrupt ( ) ; } i...
Waits until a process finishes or a timeout occurs
156,562
public T get ( ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException { if ( ex == null ) { return type ; } if ( ex instanceof InvalidBucketNameException ) ...
Returns given Type if exception is null else respective exception is thrown .
156,563
private boolean isValidEndpoint ( String endpoint ) { if ( InetAddressValidator . getInstance ( ) . isValid ( endpoint ) ) { return true ; } if ( endpoint . length ( ) < 1 || endpoint . length ( ) > 253 ) { return false ; } for ( String label : endpoint . split ( "\\." ) ) { if ( label . length ( ) < 1 || label . lengt...
Returns true if given endpoint is valid else false .
156,564
private void checkBucketName ( String name ) throws InvalidBucketNameException { if ( name == null ) { throw new InvalidBucketNameException ( NULL_STRING , "null bucket name" ) ; } if ( name . length ( ) < 3 || name . length ( ) > 63 ) { String msg = "bucket name must be at least 3 and no more than 63 characters long" ...
Validates if given bucket name is DNS compatible .
156,565
public void setTimeout ( long connectTimeout , long writeTimeout , long readTimeout ) { this . httpClient = this . httpClient . newBuilder ( ) . connectTimeout ( connectTimeout , TimeUnit . MILLISECONDS ) . writeTimeout ( writeTimeout , TimeUnit . MILLISECONDS ) . readTimeout ( readTimeout , TimeUnit . MILLISECONDS ) ....
Sets HTTP connect write and read timeouts . A value of 0 means no timeout otherwise values must be between 1 and Integer . MAX_VALUE when converted to milliseconds .
156,566
@ SuppressFBWarnings ( value = "SIC" , justification = "Should not be used in production anyways." ) public void ignoreCertCheck ( ) throws NoSuchAlgorithmException , KeyManagementException { final TrustManager [ ] trustAllCerts = new TrustManager [ ] { new X509TrustManager ( ) { public void checkClientTrusted ( X509Ce...
Ignores check on server certificate for HTTPS connection .
156,567
private boolean shouldOmitPortInHostHeader ( HttpUrl url ) { return ( url . scheme ( ) . equals ( "http" ) && url . port ( ) == 80 ) || ( url . scheme ( ) . equals ( "https" ) && url . port ( ) == 443 ) ; }
Checks whether port should be omitted in Host header .
156,568
private HttpResponse execute ( Method method , String region , String bucketName , String objectName , Map < String , String > headerMap , Map < String , String > queryParamMap , Object body , int length ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKe...
Executes given request parameters .
156,569
private void updateRegionCache ( String bucketName ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException { if ( bucketName != null && this . accessKey != n...
Updates Region cache for given bucket .
156,570
private String getRegion ( String bucketName ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException { String region ; if ( this . region == null || "" . equ...
Computes region of a given bucket name . If set this . region is considered . Otherwise resort to the server location API .
156,571
private String getText ( XmlPullParser xpp ) throws XmlPullParserException { if ( xpp . getEventType ( ) == XmlPullParser . TEXT ) { return xpp . getText ( ) ; } return null ; }
Returns text of given XML element .
156,572
private HttpResponse executeGet ( String bucketName , String objectName , Map < String , String > headerMap , Map < String , String > queryParamMap ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserExceptio...
Executes GET method for given request parameters .
156,573
private HttpResponse executeHead ( String bucketName , String objectName , Map < String , String > headerMap ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalEx...
Executes HEAD method for given request parameters .
156,574
private HttpResponse executeDelete ( String bucketName , String objectName , Map < String , String > queryParamMap ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , Inte...
Executes DELETE method for given request parameters .
156,575
private HttpResponse executePost ( String bucketName , String objectName , Map < String , String > headerMap , Map < String , String > queryParamMap , Object data ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPul...
Executes POST method for given request parameters .
156,576
public String getObjectUrl ( String bucketName , String objectName ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException { Request request = createRequest ...
Gets object s URL in given bucket . The URL is ONLY useful to retrieve the object s data if the object has public read permissions .
156,577
public void copyObject ( String bucketName , String objectName , String destBucketName ) throws InvalidKeyException , InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , NoResponseException , ErrorResponseException , InternalException , IOException , XmlPullParserException , InvalidArgum...
Copy a source object into a new destination object with same object name .
156,578
public String getPresignedObjectUrl ( Method method , String bucketName , String objectName , Integer expires , Map < String , String > reqParams ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException ...
Returns a presigned URL string with given HTTP method expiry time and custom request params for a specific object in the bucket .
156,579
public String presignedGetObject ( String bucketName , String objectName , Integer expires , Map < String , String > reqParams ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseExce...
Returns an presigned URL to download the object in the bucket with given expiry time with custom request params .
156,580
public String presignedGetObject ( String bucketName , String objectName , Integer expires ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException , InvalidE...
Returns an presigned URL to download the object in the bucket with given expiry time .
156,581
public String presignedPutObject ( String bucketName , String objectName , Integer expires ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException , InvalidE...
Returns a presigned URL to upload an object in the bucket with given expiry time .
156,582
public void removeObject ( String bucketName , String objectName ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException , InvalidArgumentException { if ( ( ...
Removes an object from a bucket .
156,583
public Iterable < Result < Item > > listObjects ( final String bucketName ) throws XmlPullParserException { return listObjects ( bucketName , null ) ; }
Lists object information in given bucket .
156,584
public Iterable < Result < Item > > listObjects ( final String bucketName , final String prefix ) throws XmlPullParserException { return listObjects ( bucketName , prefix , true ) ; }
Lists object information in given bucket and prefix .
156,585
public List < Bucket > listBuckets ( ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException { HttpResponse response = executeGet ( null , null , null , null...
Returns all bucket information owned by the current user .
156,586
public boolean bucketExists ( String bucketName ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException { try { executeHead ( bucketName , null ) ; return tr...
Checks if given bucket exist and is having read access .
156,587
public void makeBucket ( String bucketName ) throws InvalidBucketNameException , RegionConflictException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException { this . makeBucket ( bucketName...
Creates a bucket with default region .
156,588
public void makeBucket ( String bucketName , String region ) throws InvalidBucketNameException , RegionConflictException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException { if ( region ==...
Creates a bucket with given region .
156,589
private String putObject ( String bucketName , String objectName , int length , Object data , String uploadId , int partNumber , Map < String , String > headerMap ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPul...
Executes put object and returns ETag of the object .
156,590
private void putObject ( String bucketName , String objectName , Long size , Object data , Map < String , String > headerMap , ServerSideEncryption sse ) throws InvalidBucketNameException , NoSuchAlgorithmException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseExcepti...
Executes put object . If size of object data is < = 5MiB single put object is used else multipart put object is used .
156,591
public String getBucketPolicy ( String bucketName ) throws InvalidBucketNameException , InvalidObjectPrefixException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException , BucketPolicyTooLar...
Get JSON string of bucket policy of the given bucket .
156,592
public void setBucketPolicy ( String bucketName , String policy ) throws InvalidBucketNameException , InvalidObjectPrefixException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException { Map ...
Set JSON string of policy on given bucket .
156,593
public void deleteBucketLifeCycle ( String bucketName ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException { Map < String , String > queryParamMap = new H...
Delete the LifeCycle of bucket .
156,594
public String getBucketLifeCycle ( String bucketName ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException { Map < String , String > queryParamMap = new Ha...
Get bucket life cycle configuration .
156,595
public NotificationConfiguration getBucketNotification ( String bucketName ) throws InvalidBucketNameException , InvalidObjectPrefixException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalExcep...
Get bucket notification configuration
156,596
public void setBucketNotification ( String bucketName , NotificationConfiguration notificationConfiguration ) throws InvalidBucketNameException , InvalidObjectPrefixException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , Error...
Set bucket notification configuration
156,597
public void removeAllBucketNotification ( String bucketName ) throws InvalidBucketNameException , InvalidObjectPrefixException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , InternalException { Notifica...
Remove all bucket notification .
156,598
public Iterable < Result < Upload > > listIncompleteUploads ( String bucketName , String prefix ) throws XmlPullParserException { return listIncompleteUploads ( bucketName , prefix , true , true ) ; }
Lists incomplete uploads of objects in given bucket and prefix .
156,599
private String initMultipartUpload ( String bucketName , String objectName , Map < String , String > headerMap ) throws InvalidBucketNameException , NoSuchAlgorithmException , InsufficientDataException , IOException , InvalidKeyException , NoResponseException , XmlPullParserException , ErrorResponseException , Internal...
Initializes new multipart upload for given bucket name object name and content type .