Skips the <code>BOM</code> that was found in the wrapped
<code>InputStream</code> object.

@return this <code>UnicodeBOMInputStream</code>.

@throws IOException
when trying to skip the BOM from the wrapped
<code>InputStream</code> object.
768490
public final synchronized UnicodeBOMReader skipBOM() throws IOException {
		if (!skipped) {

			ByteBuffer bbuf = ByteBuffer.wrap(bom.getBytes());
			CharBuffer cbuf = charset.decode(bbuf);
			char[] bom = cbuf.array();
			int length = 0;
			for (int i = 0; i < bom.length; i++) {
				if (bom[i] == 0) {
					break;
				}
				length++;
			}
			in.skip(length);
			skipped = true;
		}
		return this;
	}
890832
public boolean skipPreamble () throws IOException
  {
    // First delimiter may be not preceeded with a CRLF.
    System.arraycopy (m_aBoundary, 2, m_aBoundary, 0, m_aBoundary.length - 2);
    m_nBoundaryLength = m_aBoundary.length - 2;
    try
    {
      // Discard all data up to the delimiter.
      discardBodyData ();

      // Read boundary - if succeded, the stream contains an
      // encapsulation.
      return readBoundary ();
    }
    catch (final MultipartMalformedStreamException e)
    {
      return false;
    }
    finally
    {
      // Restore delimiter.
      System.arraycopy (m_aBoundary, 0, m_aBoundary, 2, m_aBoundary.length - 2);
      m_nBoundaryLength = m_aBoundary.length;
      m_aBoundary[0] = CR;
      m_aBoundary[1] = LF;
    }
  }
426470
private static void skipStream(InputStream in, long count) throws IOException {
        long size = count;
        long skipped = 0;
        while (size > 0 && skipped >= 0) {
            skipped = in.skip(size);
            if (skipped != -1) {
                size -= skipped;
            }
        }
    }
1143844
@Override
  public long skip(long n)
    throws IOException
  {
    if (_is == null) {
      if (_s == null)
        return -1;

      _is = _s.getInputStream();
    }

    return _is.skip(n);
  }
143220
static public void skip(InputStream is, int size) throws IOException {
	    long n;
		while (size > 0) {
	        n = is.skip(size);
	        if (n <= 0)
	            break;
			size -= n;
		}
	}
558464
public long skip(long bytesToSkip) throws IOException {
        checkForClosed();
        long bytesSkipped = 0;
        while (bytesToSkip > bytesLeftInBuffer()) {
            bytesSkipped += bytesLeftInBuffer();
            bytesToSkip -= bytesLeftInBuffer();
            _currentBufferPosition = _bytesInBuffer;
            if (_isEof) {
                break;
            }
            loadBytesAsNeeded();
        }
        if ((bytesToSkip > 0) && (bytesToSkip <= bytesLeftInBuffer())) {
            _currentBufferPosition += (int) bytesToSkip;
            bytesSkipped += (int) bytesToSkip;
        }
        return bytesSkipped;
    }
19146
private void skipToEnd()
        throws IOException
    {
        InputStream is = getInputStream();

        if (is == null)
            return;

        if (chunkLength > 0)
            is.skip(chunkLength);

        for (int tag = is.read(); tag >= 0; tag = is.read()) {
            switch (tag) {
                case 'Y':
                    server.freeReadLock();
                    this.is = is = server.readChannel(channel);
                    if (is == null) {
                        this.server = null;
                        return;
                    }
                    break;

                case 'Q':
                    server.freeReadLock();
                    this.is = null;
                    this.server = null;
                    return;

                case -1:
                    server.freeReadLock();
                    this.is = null;
                    this.server = null;
                    return;

                default:
                    int length = (is.read() << 8) + is.read();
                    is.skip(length);
                    break;
            }
        }
    }
1142410
public InputStream toInputStream() {
        
        String text = toXml();
        return new ByteArrayInputStream(text.getBytes(StandardCharsets.UTF_8));
        
    }
335090
function() {
        var bomBuffer = this.read(bytesPerBom);
        if (bomBuffer == null || bomBuffer.length !== bytesPerBom) {
          status = 'error';
          processor.emit('processing.error', {
            file: filePath,
            message: 'Skipping file with errors during read: Unable to read past the expected BOM'
          });
          return callback(null, status);
        }
      }
919128
private static byte[] consume(final InputStream input) throws IOException {
        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
        //@checkstyle MagicNumberCheck (1 line)
        final byte[] buf = new byte[4096];
        try {
            while (true) {
                final int bytes = input.read(buf);
                if (bytes < 0) {
                    break;
                }
                baos.write(buf, 0, bytes);
            }
        } finally {
            input.close();
        }
        return baos.toByteArray();
    }
873533
def detect_unicode_bom(str)
      bom_bytes = str.byteslice(0, 4).bytes.to_a

      BOM.each do |encoding, bytes|
        if bom_bytes[0, bytes.size] == bytes
          str = str.dup
          str.force_encoding(Encoding::BINARY)
          str.slice!(0, bytes.size)
          str.force_encoding(encoding)
          return str
        end
      end

      return str
    end
649798
def read_bom(data):
    
    # common case is no BOM, so this is fast
    if data and data[0] in _FIRST_CHARS:
        for bom, encoding in _BOM_TABLE:
            if data.startswith(bom):
                return encoding, bom
    return None, None
673250
public static long skip(final InputStream input, final long toSkip) throws UncheckedIOException {
        if (toSkip < 0) {
            throw new IllegalArgumentException("Skip count must be non-negative, actual: " + toSkip);
        } else if (toSkip == 0) {
            return 0;
        }

        final byte[] buf = Objectory.createByteArrayBuffer();
        long remain = toSkip;

        try {
            while (remain > 0) {
                long n = read(input, buf, 0, (int) Math.min(remain, buf.length));

                if (n < 0) { // EOF

                    break;
                }

                remain -= n;
            }

            return toSkip - remain;
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        } finally {
            Objectory.recycle(buf);
        }
    }
1236242
public IOException unwrapRemoteException() {
    try {
      Class<?> realClass = Class.forName(getClassName());
      return instantiateException(realClass.asSubclass(IOException.class));
    } catch(Exception e) {
      // cannot instantiate the original exception, just return this
    }
    return this;
  }
881259
def detect_encoding_and_remove_bom(buf, default_encoding='UTF-8'):
    
    if not isinstance(buf, bytes):
        raise TypeError('buf should be a bytes instance but it is a %s: ' % type(buf).__name__)
    for bom, encoding in _byte_order_marks:
        if buf.startswith(bom):
            return buf[len(bom):], encoding
    return buf, default_encoding
1284406
public int skipToBoundary() throws IOException {
		int count = 0;
		while (true) {
			byte b = readByte();
			count++;
			if (isBoundary(b)) {
				break;
			}
		}
		return count;
	}
644906
public long skip(InputStream src, long n) throws IOException {
        long done;
        int chunk;

        if (n <= 0) {
            return 0;
        }
        done = 0;
        while (done < n) {
            chunk = src.read(buffer, 0, (int) Math.min(Integer.MAX_VALUE, n - done));
            if (chunk == -1) {
                break;
            }
            done += chunk;
        }
        return done;
    }