/** * Same as {@link #writeUTF} but it does not encode the length in the * first two bytes and allows strings longer than 65k to be encoded. */ public void writeUTFNoLength(String str) { if (this.ignoreWrites) return; checkIfWritable(); try { if (ASCII_STRINGS) { writeAsciiUTF(str, false); } else { writeUTF(str, false, false); } } catch (UTFDataFormatException ex) { // this shouldn't happen since we did not encode the length throw new IllegalStateException(LocalizedStrings.HeapDataOutputStream_UNEXPECTED_0.toLocalizedString(ex)); } }
if (DEBUG) debug(" utf=" + str); if (this.overflowBuf != null) { this.overflowBuf.writeUTF(str); return;
writeAsciiUTF(str, true); } else { writeUTF(str, true, true);
this.overflowBuf.writeUTF(str); return;
private void writePRCreate(String name, PRPersistentConfig config) { try { int nameLength = estimateByteSize(name); String colocatedWith = config.getColocatedWith(); colocatedWith = colocatedWith == null ? "" : colocatedWith; int colocatedLength = estimateByteSize(colocatedWith); HeapDataOutputStream hdos = new HeapDataOutputStream(1+nameLength+4+colocatedLength+1, Version.CURRENT); hdos.write(IFREC_PR_CREATE); hdos.writeUTF(name); hdos.writeInt(config.getTotalNumBuckets()); hdos.writeUTF(colocatedWith); hdos.write(END_OF_RECORD_ID); writeIFRecord(hdos, false); } catch (IOException ex) { DiskAccessException dae = new DiskAccessException(LocalizedStrings.DiskInitFile_FAILED_INIT_FILE_WRITE_BECAUSE_0.toLocalizedString(ex), this.parent); if (!this.compactInProgress) { this.parent.handleDiskAccessException(dae, true); } throw dae; } }
private void writePRCreate(String name, PRPersistentConfig config) { try { int nameLength = estimateByteSize(name); String colocatedWith = config.getColocatedWith(); colocatedWith = colocatedWith == null ? "" : colocatedWith; int colocatedLength = estimateByteSize(colocatedWith); HeapDataOutputStream hdos = new HeapDataOutputStream(1+nameLength+4+colocatedLength+1, Version.CURRENT); hdos.write(IFREC_PR_CREATE); hdos.writeUTF(name); hdos.writeInt(config.getTotalNumBuckets()); hdos.writeUTF(colocatedWith); hdos.write(END_OF_RECORD_ID); writeIFRecord(hdos, false); } catch (IOException ex) { DiskAccessException dae = new DiskAccessException(LocalizedStrings.DiskInitFile_FAILED_INIT_FILE_WRITE_BECAUSE_0.toLocalizedString(ex), this.parent); if (!this.compactInProgress) { this.parent.handleDiskAccessException(dae); } throw dae; } }
private void writePRDestroy(String name) { try { int nameLength = estimateByteSize(name); HeapDataOutputStream hdos = new HeapDataOutputStream(1 + nameLength + 4 + 1, Version.CURRENT); hdos.write(IFREC_PR_DESTROY); hdos.writeUTF(name); hdos.write(END_OF_RECORD_ID); writeIFRecord(hdos, false); } catch (IOException ex) { DiskAccessException dae = new DiskAccessException(LocalizedStrings.DiskInitFile_FAILED_INIT_FILE_WRITE_BECAUSE_0.toLocalizedString(ex), this.parent); if (!this.compactInProgress) { this.parent.handleDiskAccessException(dae); } throw dae; } }
private void writePRDestroy(String name) { try { int nameLength = estimateByteSize(name); HeapDataOutputStream hdos = new HeapDataOutputStream(1 + nameLength + 4 + 1, Version.CURRENT); hdos.write(IFREC_PR_DESTROY); hdos.writeUTF(name); hdos.write(END_OF_RECORD_ID); writeIFRecord(hdos, false); } catch (IOException ex) { DiskAccessException dae = new DiskAccessException(LocalizedStrings.DiskInitFile_FAILED_INIT_FILE_WRITE_BECAUSE_0.toLocalizedString(ex), this.parent); if (!this.compactInProgress) { this.parent.handleDiskAccessException(dae, true); } throw dae; } }
private void writeIFRecord(byte b, String s) { assert lock.isHeldByCurrentThread(); try { int hdosSize = 1 + estimateByteSize(s) + 1; if (hdosSize < 32) { hdosSize = 32; } HeapDataOutputStream hdos = new HeapDataOutputStream(hdosSize, Version.CURRENT); hdos.write(b); hdos.writeUTF(s); hdos.write(END_OF_RECORD_ID); writeIFRecord(hdos, true); } catch (IOException ex) { DiskAccessException dae = new DiskAccessException( LocalizedStrings.DiskInitFile_FAILED_INIT_FILE_WRITE_BECAUSE_0 .toLocalizedString(ex), this.parent); if (!this.compactInProgress) { this.parent.handleDiskAccessException(dae, true); } throw dae; } }
private void writeIFRecord(byte b, long regionId, String fileName) { assert lock.isHeldByCurrentThread(); try { int hdosSize = 1+DR_ID_MAX_BYTES+estimateByteSize(fileName)+1; if (hdosSize < 32) { hdosSize = 32; } HeapDataOutputStream hdos = new HeapDataOutputStream(hdosSize, Version.CURRENT); hdos.write(b); writeDiskRegionID(hdos, regionId); hdos.writeUTF(fileName); hdos.write(END_OF_RECORD_ID); writeIFRecord(hdos, true); } catch (IOException ex) { DiskAccessException dae = new DiskAccessException(LocalizedStrings.DiskInitFile_FAILED_INIT_FILE_WRITE_BECAUSE_0.toLocalizedString(ex), this.parent); if (!this.compactInProgress) { this.parent.handleDiskAccessException(dae); } throw dae; } }
private void writeIFRecord(byte b, long regionId, String fileName) { assert lock.isHeldByCurrentThread(); try { int hdosSize = 1+DR_ID_MAX_BYTES+estimateByteSize(fileName)+1; if (hdosSize < 32) { hdosSize = 32; } HeapDataOutputStream hdos = new HeapDataOutputStream(hdosSize, Version.CURRENT); hdos.write(b); writeDiskRegionID(hdos, regionId); hdos.writeUTF(fileName); hdos.write(END_OF_RECORD_ID); writeIFRecord(hdos, true); } catch (IOException ex) { DiskAccessException dae = new DiskAccessException(LocalizedStrings.DiskInitFile_FAILED_INIT_FILE_WRITE_BECAUSE_0.toLocalizedString(ex), this.parent); if (!this.compactInProgress) { this.parent.handleDiskAccessException(dae, true); } throw dae; } }
private void writeIFRecord(byte b, DiskRegionView dr, String s) { assert lock.isHeldByCurrentThread(); try { int hdosSize = 1+DR_ID_MAX_BYTES+estimateByteSize(s)+1; if (hdosSize < 32) { hdosSize = 32; } HeapDataOutputStream hdos = new HeapDataOutputStream(hdosSize, Version.CURRENT); hdos.write(b); writeDiskRegionID(hdos, dr.getId()); hdos.writeUTF(s); hdos.write(END_OF_RECORD_ID); writeIFRecord(hdos, true); } catch (IOException ex) { DiskAccessException dae = new DiskAccessException(LocalizedStrings.DiskInitFile_FAILED_INIT_FILE_WRITE_BECAUSE_0.toLocalizedString(ex), this.parent); if (!this.compactInProgress) { this.parent.handleDiskAccessException(dae); } throw dae; } }
private void writeIFRecord(byte b, DiskRegionView dr, String s) { assert lock.isHeldByCurrentThread(); try { int hdosSize = 1+DR_ID_MAX_BYTES+estimateByteSize(s)+1; if (hdosSize < 32) { hdosSize = 32; } HeapDataOutputStream hdos = new HeapDataOutputStream(hdosSize, Version.CURRENT); hdos.write(b); writeDiskRegionID(hdos, dr.getId()); hdos.writeUTF(s); hdos.write(END_OF_RECORD_ID); writeIFRecord(hdos, true); } catch (IOException ex) { DiskAccessException dae = new DiskAccessException(LocalizedStrings.DiskInitFile_FAILED_INIT_FILE_WRITE_BECAUSE_0.toLocalizedString(ex), this.parent); if (!this.compactInProgress) { this.parent.handleDiskAccessException(dae, true); } throw dae; } }
private void writeIFRecord(byte b, long regionId, String fileName, Object compactorInfo) { assert lock.isHeldByCurrentThread(); try { int hdosSize = 1+DR_ID_MAX_BYTES+estimateByteSize(fileName)+1; if (hdosSize < 32) { hdosSize = 32; } HeapDataOutputStream hdos = new HeapDataOutputStream(hdosSize, Version.CURRENT); hdos.write(b); writeDiskRegionID(hdos, regionId); hdos.writeUTF(fileName); //TODO - plum the correct compactor info to this point, to optimize //serialization DataSerializer.writeObject(compactorInfo, hdos); hdos.write(END_OF_RECORD_ID); writeIFRecord(hdos, true); } catch (IOException ex) { DiskAccessException dae = new DiskAccessException(LocalizedStrings.DiskInitFile_FAILED_INIT_FILE_WRITE_BECAUSE_0.toLocalizedString(ex), this.parent); if (!this.compactInProgress) { this.parent.handleDiskAccessException(dae, true); } throw dae; } }
private void writeIFRecord(byte b, long regionId, String fileName, Object compactorInfo) { assert lock.isHeldByCurrentThread(); try { int hdosSize = 1+DR_ID_MAX_BYTES+estimateByteSize(fileName)+1; if (hdosSize < 32) { hdosSize = 32; } HeapDataOutputStream hdos = new HeapDataOutputStream(hdosSize, Version.CURRENT); hdos.write(b); writeDiskRegionID(hdos, regionId); hdos.writeUTF(fileName); //TODO - plum the correct compactor info to this point, to optimize //serialization DataSerializer.writeObject(compactorInfo, hdos); hdos.write(END_OF_RECORD_ID); writeIFRecord(hdos, true); } catch (IOException ex) { DiskAccessException dae = new DiskAccessException(LocalizedStrings.DiskInitFile_FAILED_INIT_FILE_WRITE_BECAUSE_0.toLocalizedString(ex), this.parent); if (!this.compactInProgress) { this.parent.handleDiskAccessException(dae); } throw dae; } }
bb.writeBoolean(flags.contains(DiskRegionFlag.DEFER_RECOVERY)); bb.writeLong(drv.getUUID()); bb.writeUTF(drv.getPartitionName()); bb.writeInt(drv.getStartingBucketId()); bb.writeBoolean(false); // griddb flag, preserve for backwards compatibility bb.writeUTF(drv.getCompressorClassName() == null ? "" : drv.getCompressorClassName()); bb.writeBoolean(drv.getEnableOffHeapMemory());
bb.write((byte)(drv.isBucket()?1:0)); final EnumSet<DiskRegionFlag> flags = drv.getFlags(); bb.writeUTF(drv.getPartitionName()); bb.writeInt(drv.getStartingBucketId()); bb.writeUTF(drv.getCompressorClassName() == null ? "" : drv.getCompressorClassName()); bb.writeBoolean(flags.contains(DiskRegionFlag.IS_WITH_VERSIONING));