Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2011-2015 Amazon Technologies, Inc.
   *
   * Licensed 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://aws.amazon.com/apache2.0
   *
  * This file 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.
  */
 package com.amazonaws;
 
 
Client request options such as client markers for individual AmazonWebServiceRequests.
 
 public final class RequestClientOptions {
    
Default maximum buffer size: 128K + 1. Used to enable mark-and-reset for non-mark-and-resettable non-file input stream for up to 128K memory buffering by default. Add 1 to get around an implementation quirk of BufferedInputStream.
 
     public static final int DEFAULT_STREAM_BUFFER_SIZE = (1 << 17)+1;
     public static enum Marker {
        
Used to specify the http user_agent value. This marker is intended only for internal use by the AWS SDK.
 
         USER_AGENT,
         ;
     }
 
     private final EnumMap<Marker,Stringmarkers = new EnumMap<Marker,String>(Marker.class);
    
Used for mark-and-reset purposes during retry.
 
     private int readLimit = ;

    
Returns the value of the specified marker; or null if there is no such value.
 
     public String getClientMarker(Marker marker) {
         return .get(marker);
     }

    
Associates the given value with the given marker. Note the RequestClientOptions.Marker.USER_AGENT is only intended for internal use by the AWS SDK.
 
     public void putClientMarker(Marker markerString value) {
         .put(markervalue);
     }

    
Appends a user agent to the USER_AGENT client marker. This method is intended only for internal use by the AWS SDK.
 
     public void appendUserAgent(String userAgent) {
         String marker = .get(.);
         if (marker == null)
             marker = "";
         marker = createUserAgentMarkerString(markeruserAgent);
         putClientMarker(.marker);
     }

    
Appends the given client marker string to the existing one and returns it.
 
     private String createUserAgentMarkerString(final String markerString userAgent) {
         return marker.contains(userAgent) ? marker : marker + " " + userAgent;
     }

    
Returns the mark-and-reset read limit; defaults to DEFAULT_STREAM_BUFFER_SIZE.

 
     public final int getReadLimit() {
         return ;
     }

    
Sets the optional mark-and-reset read limit used for signing and retry purposes.

    public final void setReadLimit(int readLimit) {
        this. = readLimit;
    }

    
Copy the internal states of this RequestClientOptions to the target RequestClientOptions.
    void copyTo(RequestClientOptions target) {
        target.setReadLimit(getReadLimit());
        for (Marker marker: Marker.values())
            target.putClientMarker(markergetClientMarker(marker));
    }
New to GrepCode? Check out our FAQ X