Java Code Examples for com.microsoft.azure.storage.core.Utility#getSAXParser()

The following examples show how to use com.microsoft.azure.storage.core.Utility#getSAXParser() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServicePropertiesHandler.java    From azure-storage-android with Apache License 2.0 5 votes vote down vote up
/**
 * Parses the {@link ServiceProperties} from the given XML stream.
 * 
 * @param stream
 * @throws IOException
 * @throws SAXException
 * @throws ParserConfigurationException
 */
public static ServiceProperties readServicePropertiesFromStream(final InputStream stream) throws SAXException,
        IOException, ParserConfigurationException {
    SAXParser saxParser = Utility.getSAXParser();
    ServicePropertiesHandler handler = new ServicePropertiesHandler();
    handler.props.setLogging(null);
    handler.props.setHourMetrics(null);
    handler.props.setMinuteMetrics(null);
    handler.props.setCors(null);
    saxParser.parse(stream, handler);

    return handler.props;
}
 
Example 2
Source File: PageRangeDiffHandler.java    From azure-storage-android with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a List of Page Range Diffs for the given stream.
 * 
 * @return a List of Page Range Diffs for the given stream.
 * @throws SAXException
 * @throws ParserConfigurationException
 * @throws IOException
 */
protected static List<PageRangeDiff> getPageRangesDiff(InputStream streamRef) throws ParserConfigurationException,
        SAXException, IOException {
    SAXParser saxParser = Utility.getSAXParser();
    PageRangeDiffHandler handler = new PageRangeDiffHandler();
    saxParser.parse(streamRef, handler);

    return handler.pages;
}
 
Example 3
Source File: BlockListHandler.java    From azure-storage-android with Apache License 2.0 5 votes vote down vote up
/**
 * Parses a list of {@link BlockEntry} items from the given XML stream.
 * 
 * @throws SAXException
 * @throws ParserConfigurationException
 * @throws IOException
 */
public static ArrayList<BlockEntry> getBlockList(InputStream streamRef) throws ParserConfigurationException,
        SAXException, IOException {
    SAXParser saxParser = Utility.getSAXParser();
    BlockListHandler handler = new BlockListHandler();
    saxParser.parse(streamRef, handler);

    return handler.blocks;
}
 
Example 4
Source File: PageRangeHandler.java    From azure-storage-android with Apache License 2.0 5 votes vote down vote up
/**
 * Returns an ArrayList of Page Ranges for the given stream.
 * 
 * @return an ArrayList of Page Ranges for the given stream.
 * @throws SAXException
 * @throws ParserConfigurationException
 * @throws IOException
 */
protected static ArrayList<PageRange> getPageRanges(InputStream streamRef) throws ParserConfigurationException,
        SAXException, IOException {
    SAXParser saxParser = Utility.getSAXParser();
    PageRangeHandler handler = new PageRangeHandler();
    saxParser.parse(streamRef, handler);

    return handler.pages;
}
 
Example 5
Source File: FileRangeHandler.java    From azure-storage-android with Apache License 2.0 5 votes vote down vote up
/**
 * Returns an ArrayList of File Ranges for the given stream.
 * 
 * @return an ArrayList of File Ranges for the given stream.
 * @throws SAXException
 * @throws ParserConfigurationException
 * @throws IOException
 */
protected static ArrayList<FileRange> getFileRanges(InputStream streamRef) throws ParserConfigurationException,
        SAXException, IOException {
    SAXParser saxParser = Utility.getSAXParser();
    FileRangeHandler handler = new FileRangeHandler();
    saxParser.parse(streamRef, handler);

    return handler.fileRanges;
}
 
Example 6
Source File: ServiceStatsHandler.java    From azure-storage-android with Apache License 2.0 3 votes vote down vote up
/**
 * Constructs a {@link ServiceStats} object from an XML document received from the service.
 * 
 * @param inStream
 *            The XMLStreamReader object.
 * @return
 *         A {@link ServiceStats} object containing the properties in the XML document.
 * 
 * @throws SAXException
 * @throws ParserConfigurationException
 * @throws IOException
 */
public static ServiceStats readServiceStatsFromStream(final InputStream inStream)
        throws ParserConfigurationException, SAXException, IOException {
    SAXParser saxParser = Utility.getSAXParser();
    ServiceStatsHandler handler = new ServiceStatsHandler();
    saxParser.parse(inStream, handler);

    return handler.stats;
}
 
Example 7
Source File: SharedAccessPolicyHandler.java    From azure-storage-android with Apache License 2.0 3 votes vote down vote up
/**
 * RESERVED FOR INTERNAL USE. Gets the HashMap of SharedAccessPolicies from the response.
 * 
 * @param stream
 *            the stream to read from
 * @param cls
 *            the <code>SharedAccessPolicy</code> class type
 * @return the HashMap of SharedAccessPolicies from the response
 * @throws SAXException
 * @throws ParserConfigurationException
 * @throws ParseException
 *             if a date is incorrectly encoded in the stream
 * @throws IOException
 */
public static <T extends SharedAccessPolicy> HashMap<String, T> getAccessIdentifiers(final InputStream stream,
        final Class<T> cls) throws ParserConfigurationException, SAXException, IOException {
    SAXParser saxParser = Utility.getSAXParser();
    SharedAccessPolicyHandler<T> handler = new SharedAccessPolicyHandler<T>(cls);
    saxParser.parse(stream, handler);

    return handler.policies;
}
 
Example 8
Source File: BlobListHandler.java    From azure-storage-android with Apache License 2.0 3 votes vote down vote up
/**
 * Parse and return the response.
 * 
 * @param stream
 * @param container
 * @return
 * @throws ParserConfigurationException
 * @throws SAXException
 * @throws IOException
 */
public static ListBlobsResponse getBlobList(final InputStream stream, final CloudBlobContainer container)
        throws ParserConfigurationException, SAXException, IOException {
    SAXParser saxParser = Utility.getSAXParser();
    BlobListHandler handler = new BlobListHandler(container);
    saxParser.parse(stream, handler);

    return handler.response;
}
 
Example 9
Source File: ContainerListHandler.java    From azure-storage-android with Apache License 2.0 3 votes vote down vote up
/**
 * Parses a {@link ContainerListResponse} form the given XML stream.
 *
 * @param serviceClient
 *            a reference to the client object associated with this object.
 * @param stream
 *            the stream from which to parse the container list
 * @throws SAXException
 * @throws ParserConfigurationException
 * @throws IOException
 */
protected static ListResponse<CloudBlobContainer> getContainerList(final InputStream stream,
        final CloudBlobClient serviceClient) throws ParserConfigurationException, SAXException, IOException {
    SAXParser saxParser = Utility.getSAXParser();
    ContainerListHandler handler = new ContainerListHandler(serviceClient);
    saxParser.parse(stream, handler);

    return handler.response;
}
 
Example 10
Source File: FileListHandler.java    From azure-storage-android with Apache License 2.0 3 votes vote down vote up
/**
 * Parse and return the response.
 * 
 * @param stream
 * @param directory
 * @return
 * @throws ParserConfigurationException
 * @throws SAXException
 * @throws IOException
 */
public static ListResponse<ListFileItem> getFileAndDirectoryList(final InputStream stream,
        final CloudFileDirectory directory) throws ParserConfigurationException, SAXException, IOException {
    SAXParser saxParser = Utility.getSAXParser();
    FileListHandler handler = new FileListHandler(directory);
    saxParser.parse(stream, handler);

    return handler.response;
}
 
Example 11
Source File: ShareStatsHandler.java    From azure-storage-android with Apache License 2.0 3 votes vote down vote up
/**
 * Constructs a {@link ShareStats} object from an XML document received from the service.
 * 
 * @param inStream
 *            The XMLStreamReader object.
 * @return
 *         A {@link ShareStats} object containing the properties in the XML document.
 * 
 * @throws SAXException
 * @throws ParserConfigurationException
 * @throws IOException
 */
public static ShareStats readShareStatsFromStream(final InputStream inStream)
        throws ParserConfigurationException, SAXException, IOException {
    SAXParser saxParser = Utility.getSAXParser();
    ShareStatsHandler handler = new ShareStatsHandler();
    saxParser.parse(inStream, handler);

    return handler.stats;
}
 
Example 12
Source File: ShareListHandler.java    From azure-storage-android with Apache License 2.0 3 votes vote down vote up
/**
 * Parses a {@link ShareListResponse} form the given XML stream.
 * 
 * @param serviceClient
 *            a reference to the client object associated with this object.
 * @param stream
 *            the stream from which to parse the share list
 * @throws SAXException
 * @throws ParserConfigurationException
 * @throws IOException
 */
protected static ListResponse<CloudFileShare> getShareList(final InputStream stream,
        final CloudFileClient serviceClient) throws ParserConfigurationException, SAXException, IOException {
    SAXParser saxParser = Utility.getSAXParser();
    ShareListHandler handler = new ShareListHandler(serviceClient);
    saxParser.parse(stream, handler);

    return handler.response;
}
 
Example 13
Source File: QueueMessageHandler.java    From azure-storage-android with Apache License 2.0 3 votes vote down vote up
/**
 * Populates CloudQueueMessage objects from the XMLStreamReader; the reader must be at the Start element of
 * QueuesElement.
 * 
 * @param stream
 *            The <code>InputStream</code> object to deserialize from.
 * @param shouldEncodeMessage
 *            A flag indicating whether messages should be base-64 encoded.
 * 
 * @return An <code>ArrayList</code> of {@link CloudQueueMessage} from the
 *         stream.
 * 
 * @throws IOException
 * @throws SAXException
 * @throws ParserConfigurationException
 */
public static ArrayList<CloudQueueMessage> readMessages(final InputStream stream, final boolean shouldEncodeMessage)
        throws SAXException, IOException, ParserConfigurationException {
    SAXParser saxParser = Utility.getSAXParser();
    QueueMessageHandler handler = new QueueMessageHandler(shouldEncodeMessage);
    saxParser.parse(stream, handler);

    return handler.messages;
}
 
Example 14
Source File: QueueListHandler.java    From azure-storage-android with Apache License 2.0 3 votes vote down vote up
/**
 * Parses the input stream containing the response body of the list queues request result and populates the class
 * data.
 * 
 * @param stream
 *            The <code>InputStream</code> object to deserialize from.
 * @param serviceClient
 *            A {@link CloudQueueClient} object associated with the storage
 *            service.
 * 
 * @throws IOException
 * @throws SAXException
 * @throws ParserConfigurationException
 */
public static ListResponse<CloudQueue> getQueues(final InputStream stream, final CloudQueueClient serviceClient)
        throws SAXException, IOException, ParserConfigurationException {
    SAXParser saxParser = Utility.getSAXParser();
    QueueListHandler handler = new QueueListHandler(serviceClient);
    saxParser.parse(stream, handler);

    return handler.response;
}