protected Header readHeaderFromBuffer(ByteBuffer buffer) throws WWRuntimeException { // Read file code - first byte int fileCode = buffer.get(); if (fileCode > 5) { String message = Logging.getMessage("SHP.NotADBaseFile", file.getPath()); Logging.logger().log(java.util.logging.Level.SEVERE, message); throw new WWRuntimeException(message); } // Last update date int yy = 0xFF & buffer.get(); // unsigned int mm = buffer.get(); int dd = buffer.get(); // Number of records int numRecords = buffer.getInt(); // Header struct length int headerLength = buffer.getShort(); // Record length int recordLength = buffer.getShort(); // Assemble header Header header = new Header(); header.fileCode = fileCode; Calendar cal = Calendar.getInstance(); cal.set(1900 + yy, mm - 1, dd); header.lastModificationDate = cal.getTime(); header.numberOfRecords = numRecords; header.headerLength = headerLength; header.recordLength = recordLength; return header; }
/** Converts the Message to a String. */ public String toString() { StringBuffer sb = new StringBuffer(); OPTRecord opt = getOPT(); if (opt != null) sb.append(header.toStringWithRcode(getRcode()) + "\n"); else sb.append(header + "\n"); if (isSigned()) { sb.append(";; TSIG "); if (isVerified()) sb.append("ok"); else sb.append("invalid"); sb.append('\n'); } if (opt != null) { sb.append(";; OPT PSEUDOSECTION:\n"); sb.append("; EDNS: version: "); sb.append(opt.getVersion()); sb.append(", flags:"); if ((opt.getFlags() & ExtendedFlags.DO) != 0) { sb.append(" do"); } sb.append("; udp: "); sb.append(opt.getPayloadSize()); sb.append("\n"); } for (int i = 0; i < 4; i++) { if (header.getOpcode() != Opcode.UPDATE) sb.append(";; " + Section.longString(i) + ":\n"); else sb.append(";; " + Section.updString(i) + ":\n"); sb.append(sectionToString(i) + "\n"); } sb.append(";; Message size: " + numBytes() + " bytes"); return sb.toString(); }
public synchronized List<Header> getHeaders(String key) { List<Header> keyh = new ArrayList<Header>(); for (Header h : this.headers) { if (h.getName().equalsIgnoreCase(key.trim())) keyh.add(h); } return keyh; }
Message(DNSInput in) throws IOException { this(new Header(in)); boolean isUpdate = (header.getOpcode() == Opcode.UPDATE); boolean truncated = header.getFlag(Flags.TC); try { for (int i = 0; i < 4; i++) { int count = header.getCount(i); if (count > 0) sections[i] = new ArrayList(count); for (int j = 0; j < count; j++) { int pos = in.current(); Record rec = Record.fromWire(in, i, isUpdate); sections[i].add(rec); if (i == Section.ADDITIONAL) { if (rec.getType() == Type.TSIG) tsigstart = pos; if (rec.getType() == Type.SIG) { SIGRecord sig = (SIGRecord) rec; if (sig.getTypeCovered() == 0) sig0start = pos; } } } } } catch (WireParseException e) { if (!truncated) throw e; } size = in.current(); }
/** * Generates a byte array representing the contents of this page. Used to serialize this page to * disk. * * <p>The invariant here is that it should be possible to pass the byte array generated by * getPageData to the HeapPage constructor and have it produce an identical HeapPage object. * * @see #HeapPage * @return A byte array correspond to the bytes of this page. */ public byte[] getPageData() { // int len = header.length*4 + BufferPool.PAGE_SIZE; int len = BufferPool.PAGE_SIZE; ByteArrayOutputStream baos = new ByteArrayOutputStream(len); DataOutputStream dos = new DataOutputStream(baos); // create the header of the page try { dos.write(header.getHeader()); } catch (IOException e) { // this really shouldn't happen e.printStackTrace(); } // create the tuples for (int i = 0; i < numSlots; i++) { // empty slot if (!getSlot(i)) { for (int j = 0; j < td.getSize(); j++) { try { dos.writeByte(0); } catch (IOException e) { e.printStackTrace(); } } continue; } // non-empty slot for (int j = 0; j < td.numFields(); j++) { Field f = tuples[i].getField(j); try { f.serialize(dos); } catch (IOException e) { e.printStackTrace(); } } } // padding int zerolen = BufferPool.PAGE_SIZE - numSlots * td.getSize() - header.length(); byte[] zeroes = new byte[zerolen]; try { dos.write(zeroes, 0, zerolen); } catch (IOException e) { e.printStackTrace(); } try { dos.flush(); } catch (IOException e) { e.printStackTrace(); } return baos.toByteArray(); }
/** * Adds the specified tuple to the page. * * @throws DbException if the page is full (no empty slots) or tupledesc is mismatch. * @param t The tuple to add. */ public void addTuple(Tuple t) throws DbException { int index = header.findFirstEmptySlot(); if (index == -1) { throw new DbException("No empty slot for new tuple"); } else { header.setSlotVal(index, true); tuples[index] = t; } }
/** Creates an SGIImage from the specified data in either RGB or RGBA format. */ public static SGIImage createFromData( final int width, final int height, final boolean hasAlpha, final byte[] data) { final Header header = new Header(); header.xsize = (short) width; header.ysize = (short) height; header.zsize = (short) (hasAlpha ? 4 : 3); final SGIImage image = new SGIImage(header); image.data = data; return image; }
protected Header readHeaderFromStream(InputStream is) throws IOException { ReadableByteChannel channel = Channels.newChannel(is); // Read header fixed portion ByteBuffer headerBuffer = ShapefileUtils.readByteChannelToBuffer(channel, FIXED_HEADER_LENGTH); Header header = this.readHeaderFromBuffer(headerBuffer); // Read fields description header int fieldsHeaderLength = header.headerLength - FIXED_HEADER_LENGTH; header.fieldsHeaderBuffer = ShapefileUtils.readByteChannelToBuffer(channel, fieldsHeaderLength); return header; }
protected static Header readHeader(DataInput in) throws Exception { short magic_number = in.readShort(); Class clazz = ClassConfigurator.get(magic_number); if (clazz == null) throw new IllegalArgumentException( "magic number " + magic_number + " is not available in magic map"); Header hdr = (Header) clazz.newInstance(); hdr.readFrom(in); return hdr; }
// Microsoft doesn't follow their own specifications and the // simplest conversion using the DxTex tool to e.g. a DXT3 texture // results in an illegal .dds file without either DDSD_PITCH or // DDSD_LINEARSIZE set in the header's flags. This code, adapted // from the DevIL library, fixes up the header in these situations. private void fixupHeader() { if (isCompressed() && !isSurfaceDescFlagSet(DDSD_LINEARSIZE)) { // Figure out how big the linear size should be int depth = header.backBufferCountOrDepth; if (depth == 0) { depth = 1; } header.pitchOrLinearSize = computeCompressedBlockSize(getWidth(), getHeight(), depth, getCompressionFormat()); header.flags |= DDSD_LINEARSIZE; } }
public void write(FileOutputStream fos) throws IOException { FileChannel chan = fos.getChannel(); // Create ByteBuffer for header in case the start of our // ByteBuffer isn't actually memory-mapped ByteBuffer hdr = ByteBuffer.allocate(Header.writtenSize()); hdr.order(ByteOrder.LITTLE_ENDIAN); header.write(hdr); hdr.rewind(); chan.write(hdr); buf.position(Header.writtenSize()); chan.write(buf); chan.force(true); chan.close(); }
private static Header parseHeader(Node parent) throws XmlParserException { Header header = new Header(); NodeList nodes = parent.getChildNodes(); for (int nodeid = 0; nodeid < nodes.getLength(); ++nodeid) { Node node = nodes.item(nodeid); if (node.getNodeType() != Node.ELEMENT_NODE) continue; Element element = (Element) node; try { if (element.getTagName().equals("nrpeaks")) header.setNrPeaks(Integer.parseInt(element.getTextContent())); else if (element.getTagName().equals("date")) header.setDate(element.getTextContent()); else if (element.getTagName().equals("owner")) header.setOwner(element.getTextContent()); else if (element.getTagName().equals("description")) header.setDescription(element.getTextContent()); else if (element.getTagName().equals("sets")) header.addSetInfos(parseSets(element)); else if (element.getTagName().equals("measurements")) header.addMeasurementInfos(parseMeasurements(element)); else if (element.getTagName().equals("annotations")) { Vector<Annotation> annotations = parseAnnotations(element); if (annotations != null) for (Annotation annotation : annotations) header.addAnnotation(annotation); } } catch (Exception e) { throw new XmlParserException( "Invalid value in header (" + element.getTagName() + "): '" + e.getMessage() + "'."); } } return header; }
public void printHeaders() { if (this.request != null) { Header[] hdrs = this.request.getAllHeaders(); if (hdrs == null) hdrs = new Header[0]; System.err.println("Request Headers:"); for (Header h : hdrs) System.err.println(h.toString()); } if (this.response != null) { Header[] hdrs = this.response.getAllHeaders(); if (hdrs == null) hdrs = new Header[0]; System.err.println("Response Headers:"); for (Header h : hdrs) System.err.println(h.toString()); } System.err.flush(); }
private byte[] read(byte[] data, int pos) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayInputStream bis = new ByteArrayInputStream(data); Header header = new Header(); header.read(data, pos); bis.skip(pos + header.getSize()); InflaterInputStream inflater = new InflaterInputStream(bis); byte[] chunk = new byte[4096]; int count; while ((count = inflater.read(chunk)) >= 0) { out.write(chunk, 0, count); } inflater.close(); return out.toByteArray(); }
private void readFromBuffer(ByteBuffer buf) throws IOException { this.buf = buf; buf.order(ByteOrder.LITTLE_ENDIAN); header = new Header(); header.read(buf); fixupHeader(); }
public void process(final HttpResponse response, final HttpContext context) throws HttpException, IOException { HttpEntity entity = response.getEntity(); if (entity != null) { Header ceheader = entity.getContentEncoding(); if (ceheader != null) { HeaderElement[] codecs = ceheader.getElements(); for (HeaderElement h : codecs) { if (h.getName().equalsIgnoreCase("deflate")) { response.setEntity(new DeflateDecompressingEntity(response.getEntity())); return; } } } } }
/** * Gets the <i>i</i>th mipmap data (0..getNumMipMaps() - 1) * * @param side Cubemap side or 0 for 2D texture * @param map Mipmap index * @return Image object */ public ImageInfo getMipMap(int side, int map) { if (!isCubemap() && (side != 0)) { throw new RuntimeException("Illegal side for 2D texture: " + side); } if (isCubemap() && !isCubemapSidePresent(side)) { throw new RuntimeException("Illegal side, side not present: " + side); } if (getNumMipMaps() > 0 && ((map < 0) || (map >= getNumMipMaps()))) { throw new RuntimeException( "Illegal mipmap number " + map + " (0.." + (getNumMipMaps() - 1) + ")"); } // Figure out how far to seek int seek = Header.writtenSize(); if (isCubemap()) { seek += sideShiftInBytes(side); } for (int i = 0; i < map; i++) { seek += mipMapSizeInBytes(i); } buf.limit(seek + mipMapSizeInBytes(map)); buf.position(seek); ByteBuffer next = buf.slice(); buf.position(0); buf.limit(buf.capacity()); return new ImageInfo( next, mipMapWidth(map), mipMapHeight(map), isCompressed(), getCompressionFormat()); }
/** * Returns the TSIG record from the ADDITIONAL section, if one is present. * * @see TSIGRecord * @see TSIG * @see Section */ public TSIGRecord getTSIG() { int count = header.getCount(Section.ADDITIONAL); if (count == 0) return null; List l = sections[Section.ADDITIONAL]; Record rec = (Record) l.get(count - 1); if (rec.type != Type.TSIG) return null; return (TSIGRecord) rec; }
/** * Creates a copy of this Message. This is done by the Resolver before adding TSIG and OPT * records, for example. * * @see Resolver * @see TSIGRecord * @see OPTRecord */ public Object clone() { Message m = new Message(); for (int i = 0; i < sections.length; i++) { if (sections[i] != null) m.sections[i] = new LinkedList(sections[i]); } m.header = (Header) header.clone(); m.size = size; return m; }
private void decodeImage(final DataInputStream in) throws IOException { if (header.storage == 1) { // Read RLE compression data; row starts and sizes final int x = header.ysize * header.zsize; rowStart = new int[x]; rowSize = new int[x]; rleEnd = 4 * 2 * x + 512; for (int i = 0; i < x; i++) { rowStart[i] = in.readInt(); } for (int i = 0; i < x; i++) { rowSize[i] = in.readInt(); } tmpRead = new byte[header.xsize * 256]; } tmpData = readAll(in); final int xsize = header.xsize; final int ysize = header.ysize; final int zsize = header.zsize; int lptr = 0; data = new byte[xsize * ysize * 4]; final byte[] rbuf = new byte[xsize]; final byte[] gbuf = new byte[xsize]; final byte[] bbuf = new byte[xsize]; final byte[] abuf = new byte[xsize]; for (int y = 0; y < ysize; y++) { if (zsize >= 4) { getRow(rbuf, y, 0); getRow(gbuf, y, 1); getRow(bbuf, y, 2); getRow(abuf, y, 3); rgbatorgba(rbuf, gbuf, bbuf, abuf, data, lptr); } else if (zsize == 3) { getRow(rbuf, y, 0); getRow(gbuf, y, 1); getRow(bbuf, y, 2); rgbtorgba(rbuf, gbuf, bbuf, data, lptr); } else if (zsize == 2) { getRow(rbuf, y, 0); getRow(abuf, y, 1); latorgba(rbuf, abuf, data, lptr); } else { getRow(rbuf, y, 0); bwtorgba(rbuf, data, lptr); } lptr += 4 * xsize; } rowStart = null; rowSize = null; tmpData = null; tmpRead = null; format = GL.GL_RGBA; header.zsize = 4; }
/** Converts the Message to a String. */ public String toString() { StringBuffer sb = new StringBuffer(); OPTRecord opt = getOPT(); if (opt != null) sb.append(header.toStringWithRcode(getRcode()) + "\n"); else sb.append(header + "\n"); if (isSigned()) { sb.append(";; TSIG "); if (isVerified()) sb.append("ok"); else sb.append("invalid"); sb.append('\n'); } for (int i = 0; i < 4; i++) { if (header.getOpcode() != Opcode.UPDATE) sb.append(";; " + Section.longString(i) + ":\n"); else sb.append(";; " + Section.updString(i) + ":\n"); sb.append(sectionToString(i) + "\n"); } sb.append(";; Message size: " + numBytes() + " bytes"); return sb.toString(); }
private void checkHeaders(HTTPMethod method) { if (debugHeaders) { System.out.println("\nOpenConnection Headers for " + method.getPath()); System.out.println("Status Line: " + method.getStatusLine()); } Header[] responseHeaders = method.getResponseHeaders(); for (int i1 = 0; i1 < responseHeaders.length; i1++) { Header responseHeader = responseHeaders[i1]; if (debugHeaders) System.out.print(" " + responseHeader); String key = responseHeader.getName(); String value = responseHeader.getValue(); if (key.equals("Last-Modified")) { lastModified = value; if (debugHeaders) System.out.println(" **found lastModified = " + lastModified); } else if (key.equals("X-Last-Extended")) { lastExtended = value; if (debugHeaders) System.out.println(" **found lastExtended = " + lastExtended); } else if (key.equals("X-Last-Modified-Invalid")) { lastModifiedInvalid = value; if (debugHeaders) System.out.println(" **found lastModifiedInvalid = " + lastModifiedInvalid); } } if (debugHeaders) System.out.println("OpenConnection Headers for " + method.getPath()); Cookie[] cookies = _session.getCookies(); if (cookies.length > 0) { if (debugHeaders) System.out.println("Cookies= "); for (int i = 0; i < cookies.length; i++) { Cookie cooky = cookies[i]; if (debugHeaders) System.out.println(" " + cooky); if (cooky.getName().equalsIgnoreCase("jsessionid")) hasSession = true; } } }
void toWire(DNSOutput out) { header.toWire(out); Compression c = new Compression(); for (int i = 0; i < 4; i++) { if (sections[i] == null) continue; for (int j = 0; j < sections[i].size(); j++) { Record rec = (Record) sections[i].get(j); rec.toWire(out, i, c); } } }
/* Returns true if the message could be rendered. */ private boolean toWire(DNSOutput out, int maxLength) { if (maxLength < Header.LENGTH) return false; Header newheader = null; int tempMaxLength = maxLength; if (tsigkey != null) tempMaxLength -= tsigkey.recordLength(); OPTRecord opt = getOPT(); byte[] optBytes = null; if (opt != null) { optBytes = opt.toWire(Section.ADDITIONAL); tempMaxLength -= optBytes.length; } int startpos = out.current(); header.toWire(out); Compression c = new Compression(); int flags = header.getFlagsByte(); int additionalCount = 0; for (int i = 0; i < 4; i++) { int skipped; if (sections[i] == null) continue; skipped = sectionToWire(out, i, c, tempMaxLength); if (skipped != 0 && i != Section.ADDITIONAL) { flags = Header.setFlag(flags, Flags.TC, true); out.writeU16At(header.getCount(i) - skipped, startpos + 4 + 2 * i); for (int j = i + 1; j < Section.ADDITIONAL; j++) out.writeU16At(0, startpos + 4 + 2 * j); break; } if (i == Section.ADDITIONAL) additionalCount = header.getCount(i) - skipped; } if (optBytes != null) { out.writeByteArray(optBytes); additionalCount++; } if (flags != header.getFlagsByte()) out.writeU16At(flags, startpos + 2); if (additionalCount != header.getCount(Section.ADDITIONAL)) out.writeU16At(additionalCount, startpos + 10); if (tsigkey != null) { TSIGRecord tsigrec = tsigkey.generate(this, out.toByteArray(), tsigerror, querytsig); tsigrec.toWire(out, Section.ADDITIONAL, c); out.writeU16At(additionalCount + 1, startpos + 10); } return true; }
public void setData(byte[] data) throws IOException { int pos = 512; // skip the first 512 bytes - they are MAC specific crap byte[] compressed = compress(data, pos, data.length - pos); Header header = new Header(); header.wmfsize = data.length - 512; // we don't have a PICT reader in java, have to set default image size 200x200 header.bounds = new java.awt.Rectangle(0, 0, 200, 200); header.size = new java.awt.Dimension( header.bounds.width * Shape.EMU_PER_POINT, header.bounds.height * Shape.EMU_PER_POINT); header.zipsize = compressed.length; byte[] checksum = getChecksum(data); ByteArrayOutputStream out = new ByteArrayOutputStream(); out.write(checksum); out.write(new byte[16]); // 16-byte prefix which is safe to ignore header.write(out); out.write(compressed); setRawData(out.toByteArray()); }
/** * Removes all records from a section of the Message, and adjusts the header. * * @see Record * @see Section */ public void removeAllRecords(int section) { sections[section] = null; header.setCount(section, 0); }
protected static void writeHeader(Header hdr, DataOutput out) throws Exception { short magic_number = ClassConfigurator.getMagicNumber(hdr.getClass()); out.writeShort(magic_number); hdr.writeTo(out); }
public void mainloop() { while (!client.isConnected()) { try { System.out.println("Connecting to " + hostname + ":" + port); client.connect(hostname, port); } catch (IOException e) { } if (!client.isConnected()) { System.out.println("Couldn't connect. waiting"); try { Thread.sleep(1000); } catch (InterruptedException e) { run = false; System.exit(-1); } } } // Load the header information in one go into a bytebuffer byte[] rawbytebuf = new byte[BUFFERSIZE]; int n = 0; try { n = headerReader.read(rawbytebuf); } catch (IOException e) { e.printStackTrace(); } // Byte-buffer used to parse the byte-stream. Force native ordering ByteBuffer hdrBuf = ByteBuffer.wrap(rawbytebuf, 0, n); hdrBuf.order(ByteOrder.nativeOrder()); Header hdr = new Header(hdrBuf); if (VERB > 0) { System.out.println("Sending header: " + hdr.toString()); } hdr.nSamples = 0; // reset number of samples to 0 try { client.putHeader(hdr); } catch (IOException e) { e.printStackTrace(); } // Interval between sending samples to the buffer int pktSamples = hdr.nChans * blockSize; // number data samples in each buffer packet int pktBytes = pktSamples * DataType.wordSize[hdr.dataType]; int nsamp = 0; // sample counter int nblk = 0; int nevent = 0; byte[] samples = new byte[pktBytes]; // Size of the event header: type,type_numel,val,val_numel,sample,offset,duration,bufsz int evtHdrSz = DataType.wordSize[DataType.INT32] * 8; byte[] evtRawBuf = new byte[BUFFERSIZE]; // buffer to hold complete event structure // Byte-buffer used to parse the byte-stream. Force native ordering ByteBuffer evtBuf = ByteBuffer.wrap(evtRawBuf); evtBuf.order(ByteOrder.nativeOrder()); int payloadSz = 0; int evtSample = 0; int evtSz = 0; long sample_ms = 0; long starttime_ms = java.lang.System.currentTimeMillis(); long elapsed_ms = 0; long print_ms = 0; // Now do the data forwarding boolean eof = false; while (!eof && run) { // The run switch allows control of stopping the thread and getting out of the // loop // Read one buffer packets worth of samples // increment the cursor position if (VERB > 0 && elapsed_ms > print_ms + 500) { print_ms = elapsed_ms; System.out.println( nblk + " " + nsamp + " " + nevent + " " + (elapsed_ms / 1000) + " (blk,samp,event,sec)\r"); } // read and write the samples try { n = dataReader.read(samples); } catch (IOException e) { e.printStackTrace(); } if (n <= 0) { eof = true; break; } // stop if run out of samples try { client.putRawData(blockSize, hdr.nChans, hdr.dataType, samples); } catch (IOException e) { e.printStackTrace(); } // update the sample count nsamp += blockSize; while (evtSample <= nsamp) { if (evtSample > 0) { // send the current event try { client.putRawEvent(evtRawBuf, 0, evtSz); } catch (IOException e) { e.printStackTrace(); } nevent++; } // read the next event try { n = eventReader.read(evtRawBuf, 0, evtHdrSz); // read the fixed size header } catch (IOException e) { e.printStackTrace(); } if (n <= 0) { eof = true; break; } evtSample = ((ByteBuffer) evtBuf.position(4 * 4)).getInt(); // sample index for this event payloadSz = ((ByteBuffer) evtBuf.position(4 * 7)).getInt(); // payload size for this event evtSz = evtHdrSz + payloadSz; // read the variable part try { n = eventReader.read(evtRawBuf, evtHdrSz, payloadSz); } catch (IOException e) { e.printStackTrace(); } if (n <= 0) { eof = true; break; } // print the event we just read if (VERB > 1) { ByteBuffer tmpev = ByteBuffer.wrap(evtRawBuf, 0, evtSz); tmpev.order(evtBuf.order()); BufferEvent evt = new BufferEvent(tmpev); System.out.println("Read Event: " + evt); } } // sleep until the next packet should be send OR EOF /*when to send the next sample */ sample_ms = (long) ((float) (nsamp * 1000) / hdr.fSample / (float) speedup); elapsed_ms = java.lang.System.currentTimeMillis() - starttime_ms; // current time if (sample_ms > elapsed_ms) try { Thread.sleep(sample_ms - elapsed_ms); } catch (InterruptedException e) { e.printStackTrace(); } nblk++; } stop(); }
/** Returns the message's rcode (error code). This incorporates the EDNS extended rcode. */ public int getRcode() { int rcode = header.getRcode(); OPTRecord opt = getOPT(); if (opt != null) rcode += (opt.getExtendedRcode() << 4); return rcode; }
/* Returns true if the message could be rendered. */ private boolean toWire(DNSOutput out, int maxLength) { if (maxLength < Header.LENGTH) return false; Header newheader = null; int tempMaxLength = maxLength; if (tsigkey != null) tempMaxLength -= tsigkey.recordLength(); int startpos = out.current(); header.toWire(out); Compression c = new Compression(); for (int i = 0; i < 4; i++) { int skipped; if (sections[i] == null) continue; skipped = sectionToWire(out, i, c, tempMaxLength); if (skipped != 0) { if (i != Section.ADDITIONAL) { if (newheader == null) newheader = (Header) header.clone(); newheader.setFlag(Flags.TC); int count = newheader.getCount(i); newheader.setCount(i, count - skipped); for (int j = i + 1; j < 4; j++) newheader.setCount(j, 0); out.save(); out.jump(startpos); newheader.toWire(out); out.restore(); } break; } } if (tsigkey != null) { TSIGRecord tsigrec = tsigkey.generate(this, out.toByteArray(), tsigerror, querytsig); if (newheader == null) newheader = (Header) header.clone(); tsigrec.toWire(out, Section.ADDITIONAL, c); newheader.incCount(Section.ADDITIONAL); out.save(); out.jump(startpos); newheader.toWire(out); out.restore(); } return true; }