/** * Skips the encoded console note. */ public static void skip(DataInputStream in) throws IOException { byte[] preamble = new byte[PREAMBLE.length]; in.readFully(preamble); if (!Arrays.equals(preamble,PREAMBLE)) return; // not a valid preamble DataInputStream decoded = new DataInputStream(new UnbufferedBase64InputStream(in)); int macSz = - decoded.readInt(); if (macSz > 0) { // new format IOUtils.skip(decoded, macSz); int sz = decoded.readInt(); IOUtils.skip(decoded, sz); } else { // old format int sz = -macSz; IOUtils.skip(decoded, sz); } byte[] postamble = new byte[POSTAMBLE.length]; in.readFully(postamble); }
private void drainOutput(HttpURLConnection conn) throws IOException { // for things like unauthorised (401) we won't have any content and getting the inputStream will // cause an IOException as we are in error - but there is no really way to tell this so check the // length instead. if (conn.getContentLength() > 0) { if (conn.getContentLength() < 1024) { byte[] data = new byte[conn.getConnectTimeout()]; } if (conn.getErrorStream() != null) { IOUtils.skip(conn.getErrorStream(), conn.getContentLength()); } else { IOUtils.skip(conn.getInputStream(), conn.getContentLength()); } } }
/** * Skips the encoded console note. */ public static void skip(DataInputStream in) throws IOException { byte[] preamble = new byte[PREAMBLE.length]; in.readFully(preamble); if (!Arrays.equals(preamble,PREAMBLE)) return; // not a valid preamble DataInputStream decoded = new DataInputStream(new UnbufferedBase64InputStream(in)); int macSz = - decoded.readInt(); if (macSz > 0) { // new format IOUtils.skip(decoded, macSz); int sz = decoded.readInt(); IOUtils.skip(decoded, sz); } else { // old format int sz = -macSz; IOUtils.skip(decoded, sz); } byte[] postamble = new byte[POSTAMBLE.length]; in.readFully(postamble); }
/** * Skips the encoded console note. */ public static void skip(DataInputStream in) throws IOException { byte[] preamble = new byte[PREAMBLE.length]; in.readFully(preamble); if (!Arrays.equals(preamble,PREAMBLE)) return; // not a valid preamble DataInputStream decoded = new DataInputStream(new UnbufferedBase64InputStream(in)); int sz = decoded.readInt(); IOUtils.skip(decoded,sz); byte[] postamble = new byte[POSTAMBLE.length]; in.readFully(postamble); }
/** * Skips the encoded console note. */ public static void skip(DataInputStream in) throws IOException { byte[] preamble = new byte[PREAMBLE.length]; in.readFully(preamble); if (!Arrays.equals(preamble,PREAMBLE)) return; // not a valid preamble DataInputStream decoded = new DataInputStream(new UnbufferedBase64InputStream(in)); int sz = decoded.readInt(); IOUtils.skip(decoded,sz); byte[] postamble = new byte[POSTAMBLE.length]; in.readFully(postamble); }
/** * Skips the encoded console note. */ public static void skip(DataInputStream in) throws IOException { byte[] preamble = new byte[PREAMBLE.length]; in.readFully(preamble); if (!Arrays.equals(preamble,PREAMBLE)) return; // not a valid preamble DataInputStream decoded = new DataInputStream(new UnbufferedBase64InputStream(in)); int sz = decoded.readInt(); IOUtils.skip(decoded,sz); byte[] postamble = new byte[POSTAMBLE.length]; in.readFully(postamble); }
/** * Skips the encoded console note. */ public static void skip(DataInputStream in) throws IOException { byte[] preamble = new byte[PREAMBLE.length]; in.readFully(preamble); if (!Arrays.equals(preamble, PREAMBLE)) { return; // not a valid preamble } DataInputStream decoded = new DataInputStream(new UnbufferedBase64InputStream(in)); int sz = decoded.readInt(); IOUtils.skip(decoded, sz); byte[] postamble = new byte[POSTAMBLE.length]; in.readFully(postamble); } private static final long serialVersionUID = 1L;