Class GSObject

    • Constructor Detail

      • GSObject

        public GSObject​(File file)
                 throws NoSuchAlgorithmException,
                        IOException
        Create an object representing a file. The object is initialised with the file's name as its key, the file's content as its data, a content type based on the file's extension (see Mimetypes), and a content length matching the file's size. The file's MD5 hash value is also calculated and provided to the service so it can verify that no data are corrupted in transit.

        NOTE: The automatic calculation of a file's MD5 hash digest as performed by this constructor could take some time for large files, or for many small ones.

        Parameters:
        file - the file the object will represent. This file must exist and be readable.
        Throws:
        IOException - when an i/o error occurred reading the file
        NoSuchAlgorithmException - when this JRE doesn't support the MD5 hash algorithm
      • GSObject

        public GSObject​(String key,
                        String dataString)
                 throws NoSuchAlgorithmException,
                        IOException
        Create an object representing text data. The object is initialized with the given key, the given string as its data content (encoded as UTF-8), a content type of text/plain; charset=utf-8, and a content length matching the string's length. The given string's MD5 hash value is also calculated and provided to the service so it can verify that no data are corrupted in transit.

        NOTE: The automatic calculation of the MD5 hash digest as performed by this constructor could take some time for large strings, or for many small ones.

        Parameters:
        key - the key name for the object.
        dataString - the text data the object will contain. Text data will be encoded as UTF-8. This string cannot be null.
        Throws:
        IOException
        NoSuchAlgorithmException - when this JRE doesn't support the MD5 hash algorithm
      • GSObject

        public GSObject​(String key)
        Create an object without any associated data, and no associated bucket.
        Parameters:
        key - the key name for the object.
      • GSObject

        public GSObject()
        Create an object without any associated information whatsoever.