Package java.io

Examples of java.io.BufferedInputStream.mark()


                {
                    hasBOM = true;
                    charset = "UTF16-LE";

                    // Check two more bytes incase we have UTF-32
                    bufferedIn.mark(2);
                    read = bufferedIn.read();
                    if (0x00 == (read & 0xFF))
                    {
                        read = bufferedIn.read();
                        if (0x00 == (read & 0xFF))
View Full Code Here


     * @throws java.io.IOException
     */
    private InputStream createDocumentInputStream(InputStream is) throws IOException
    {
        BufferedInputStream bin = new BufferedInputStream(is);
        bin.mark(2);
        int b0 = bin.read();
        int b1 = bin.read();
        bin.reset();

        //Check for gzip magic number
View Full Code Here

    }
   
    protected Bundle installBundleIfNeeded(String bundleLocation) throws IOException, BundleException {
        InputStream is = new BufferedInputStream(new URL(bundleLocation).openStream());
        try {
            is.mark(256 * 1024);
            JarInputStream jar = new JarInputStream(is);
            Manifest m = jar.getManifest();
            String sn = m.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME);
            String vStr = m.getMainAttributes().getValue(Constants.BUNDLE_VERSION);
            Version v = vStr == null ? Version.emptyVersion : Version.parseVersion(vStr);
View Full Code Here

    }
    protected Bundle installBundleIfNeeded(String bundleLocation) throws IOException, BundleException {
        LOGGER.debug("Checking " + bundleLocation);
        InputStream is = new BufferedInputStream(new URL(bundleLocation).openStream());
        try {
            is.mark(256 * 1024);
            JarInputStream jar = new JarInputStream(is);
            Manifest m = jar.getManifest();
            String sn = m.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME);
            String vStr = m.getMainAttributes().getValue(Constants.BUNDLE_VERSION);
            Version v = vStr == null ? Version.emptyVersion : Version.parseVersion(vStr);
View Full Code Here

    lastModified = liveFile.lastModified();

    // After the file entries are index extensions, and then a footer.
    //
    for (;;) {
      in.mark(21);
      IO.readFully(in, hdr, 0, 20);
      if (in.read() < 0) {
        // No extensions present; the file ended where we expected.
        //
        break;
View Full Code Here

    InputStream inputGoldStream =
        new PossiblyDecompressedInputStream(goldPath, conf);

    BufferedInputStream bis = new BufferedInputStream(inputLogStream);
    bis.mark(10000);
    Hadoop20JHParser parser = new Hadoop20JHParser(bis);

    final Path resultPath = new Path(tempDir, "result.text");

    System.out.println("testHadoop20JHParser sent its output to " + resultPath);
View Full Code Here

        {
            enc = "ISO-8859-1";
        }

        BufferedInputStream is = new BufferedInputStream(conn.getInputStream());
        is.mark(20480);
        BufferedReader asciiReader = new BufferedReader(new InputStreamReader(is, "ASCII"));
        String decl = asciiReader.readLine();
        String key = "encoding=\"";
        if (decl != null)
        {
View Full Code Here

        BufferedInputStream is = new BufferedInputStream(getInputStream(path));

        String enc = "UTF-8";
        try
        {
            is.mark(MAX_BUFFER_SIZE);
            byte[] buf = new byte[MAX_BUFFER_SIZE];
            int size = is.read(buf, 0, MAX_BUFFER_SIZE);
            if (size > 0)
            {
                String key = "encoding=\"";
View Full Code Here

    public synchronized void load(InputStream in) throws IOException {
        if (in == null) {
            throw new NullPointerException();
        }
        BufferedInputStream bis = new BufferedInputStream(in);
        bis.mark(Integer.MAX_VALUE);
        boolean isEbcdic = isEbcdic(bis);
        bis.reset();

        if(!isEbcdic){
            load(new InputStreamReader(bis, "ISO8859-1")); //$NON-NLS-1$
View Full Code Here

            InputStream in = httpRequest.getInputStream();
            if (in != null) {
                // use a buffered input stream to find out whether there actually
                // is a request body
                InputStream bin = new BufferedInputStream(in);
                bin.mark(1);
                boolean isEmpty = -1 == bin.read();
                bin.reset();
                if (!isEmpty) {
                    DocumentBuilder docBuilder = DomUtil.BUILDER_FACTORY.newDocumentBuilder();
                    requestDocument = docBuilder.parse(bin);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.