- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {StringBuilder s =
new StringBuilder()
new StringBuilder(32)
String str;new StringBuilder(str)
- Smart code suggestions by Codota
}
/** * Get the chunk data as a string. * * @return the string */ public String asString() { StringBuilder buff = new StringBuilder(240); DataUtils.appendMap(buff, "chunk", id); DataUtils.appendMap(buff, "block", block); DataUtils.appendMap(buff, "len", len); if (maxLen != maxLenLive) { DataUtils.appendMap(buff, "liveMax", maxLenLive); } if (pageCount != pageCountLive) { DataUtils.appendMap(buff, "livePages", pageCountLive); } DataUtils.appendMap(buff, "map", mapId); DataUtils.appendMap(buff, "max", maxLen); if (next != 0) { DataUtils.appendMap(buff, "next", next); } DataUtils.appendMap(buff, "pages", pageCount); DataUtils.appendMap(buff, "root", metaRootPos); DataUtils.appendMap(buff, "time", time); if (unused != 0) { DataUtils.appendMap(buff, "unused", unused); } DataUtils.appendMap(buff, "version", version); return buff.toString(); }
@Override public String toString() { return DataUtils.appendMap(new StringBuilder(), config).toString(); }
byte[] getFooterBytes() { StringBuilder buff = new StringBuilder(FOOTER_LENGTH); DataUtils.appendMap(buff, "chunk", id); DataUtils.appendMap(buff, "block", block); DataUtils.appendMap(buff, "version", version); byte[] bytes = buff.toString().getBytes(StandardCharsets.ISO_8859_1); int checksum = DataUtils.getFletcher32(bytes, 0, bytes.length); DataUtils.appendMap(buff, "fletcher", checksum); while (buff.length() < FOOTER_LENGTH - 1) { buff.append(' '); } buff.append('\n'); return buff.toString().getBytes(StandardCharsets.ISO_8859_1); }
/** * Get the map metadata as a string. * * @param name the map name (or null) * @return the string */ String asString(String name) { StringBuilder buff = new StringBuilder(); if (name != null) { DataUtils.appendMap(buff, "name", name); } if (createVersion != 0) { DataUtils.appendMap(buff, "createVersion", createVersion); } String type = getType(); if (type != null) { DataUtils.appendMap(buff, "type", type); } return buff.toString(); }
/** * Append a map to the string builder, sorted by key. * * @param buff the target buffer * @param map the map * @return the string builder */ public static StringBuilder appendMap(StringBuilder buff, HashMap<String, ?> map) { Object[] keys = map.keySet().toArray(); Arrays.sort(keys); for (Object k : keys) { String key = (String) k; Object value = map.get(key); if (value instanceof Long) { appendMap(buff, key, (long) value); } else if (value instanceof Integer) { appendMap(buff, key, (int) value); } else { appendMap(buff, key, value.toString()); } } return buff; }
private void writeStoreHeader() { StringBuilder buff = new StringBuilder(112); if (lastChunk != null) { storeHeader.put("block", lastChunk.block); storeHeader.put("chunk", lastChunk.id); storeHeader.put("version", lastChunk.version); } DataUtils.appendMap(buff, storeHeader); byte[] bytes = buff.toString().getBytes(StandardCharsets.ISO_8859_1); int checksum = DataUtils.getFletcher32(bytes, 0, bytes.length); DataUtils.appendMap(buff, "fletcher", checksum); buff.append('\n'); bytes = buff.toString().getBytes(StandardCharsets.ISO_8859_1); ByteBuffer header = ByteBuffer.allocate(2 * BLOCK_SIZE); header.put(bytes); header.position(BLOCK_SIZE); header.put(bytes); header.rewind(); write(0, header); }
@Override public String toString() { return DataUtils.appendMap(new StringBuilder(), config).toString(); }
@Override public String toString() { return DataUtils.appendMap(new StringBuilder(), config).toString(); }
@Override public String toString() { return DataUtils.appendMap(new StringBuilder(), config).toString(); }
byte[] getFooterBytes() { StringBuilder buff = new StringBuilder(); DataUtils.appendMap(buff, "chunk", id); DataUtils.appendMap(buff, "block", block); DataUtils.appendMap(buff, "version", version); byte[] bytes = buff.toString().getBytes(DataUtils.LATIN); int checksum = DataUtils.getFletcher32(bytes, bytes.length); DataUtils.appendMap(buff, "fletcher", checksum); while (buff.length() < Chunk.FOOTER_LENGTH - 1) { buff.append(' '); } buff.append("\n"); return buff.toString().getBytes(DataUtils.LATIN); }
byte[] getFooterBytes() { StringBuilder buff = new StringBuilder(FOOTER_LENGTH); DataUtils.appendMap(buff, "chunk", id); DataUtils.appendMap(buff, "block", block); DataUtils.appendMap(buff, "version", version); byte[] bytes = buff.toString().getBytes(StandardCharsets.ISO_8859_1); int checksum = DataUtils.getFletcher32(bytes, 0, bytes.length); DataUtils.appendMap(buff, "fletcher", checksum); while (buff.length() < FOOTER_LENGTH - 1) { buff.append(' '); } buff.append('\n'); return buff.toString().getBytes(StandardCharsets.ISO_8859_1); }
byte[] getFooterBytes() { StringBuilder buff = new StringBuilder(); DataUtils.appendMap(buff, "chunk", id); DataUtils.appendMap(buff, "block", block); DataUtils.appendMap(buff, "version", version); byte[] bytes = buff.toString().getBytes(DataUtils.LATIN); int checksum = DataUtils.getFletcher32(bytes, bytes.length); DataUtils.appendMap(buff, "fletcher", checksum); while (buff.length() < Chunk.FOOTER_LENGTH - 1) { buff.append(' '); } buff.append("\n"); return buff.toString().getBytes(DataUtils.LATIN); }
/** * Get the map metadata as a string. * * @param name the map name (or null) * @return the string */ String asString(String name) { StringBuilder buff = new StringBuilder(); if (name != null) { DataUtils.appendMap(buff, "name", name); } if (createVersion != 0) { DataUtils.appendMap(buff, "createVersion", createVersion); } String type = getType(); if (type != null) { DataUtils.appendMap(buff, "type", type); } return buff.toString(); }
/** * Get the map metadata as a string. * * @param name the map name (or null) * @return the string */ String asString(String name) { StringBuilder buff = new StringBuilder(); if (name != null) { DataUtils.appendMap(buff, "name", name); } if (createVersion != 0) { DataUtils.appendMap(buff, "createVersion", createVersion); } String type = getType(); if (type != null) { DataUtils.appendMap(buff, "type", type); } return buff.toString(); }
/** * Get the map metadata as a string. * * @param name the map name (or null) * @return the string */ String asString(String name) { StringBuilder buff = new StringBuilder(); if (name != null) { DataUtils.appendMap(buff, "name", name); } if (createVersion != 0) { DataUtils.appendMap(buff, "createVersion", createVersion); } String type = getType(); if (type != null) { DataUtils.appendMap(buff, "type", type); } return buff.toString(); }
/** * Append a map to the string builder, sorted by key. * * @param buff the target buffer * @param map the map * @return the string builder */ public static StringBuilder appendMap(StringBuilder buff, HashMap<String, ?> map) { ArrayList<String> list = New.arrayList(map.keySet()); Collections.sort(list); for (String k : list) { appendMap(buff, k, map.get(k)); } return buff; }
/** * Append a map to the string builder, sorted by key. * * @param buff the target buffer * @param map the map * @return the string builder */ public static StringBuilder appendMap(StringBuilder buff, HashMap<String, ?> map) { ArrayList<String> list = New.arrayList(map.keySet()); Collections.sort(list); for (String k : list) { appendMap(buff, k, map.get(k)); } return buff; }
private void writeStoreHeader() { StringBuilder buff = new StringBuilder(112); if (lastChunk != null) { storeHeader.put("block", lastChunk.block); storeHeader.put("chunk", lastChunk.id); storeHeader.put("version", lastChunk.version); } DataUtils.appendMap(buff, storeHeader); byte[] bytes = buff.toString().getBytes(StandardCharsets.ISO_8859_1); int checksum = DataUtils.getFletcher32(bytes, 0, bytes.length); DataUtils.appendMap(buff, "fletcher", checksum); buff.append('\n'); bytes = buff.toString().getBytes(StandardCharsets.ISO_8859_1); ByteBuffer header = ByteBuffer.allocate(2 * BLOCK_SIZE); header.put(bytes); header.position(BLOCK_SIZE); header.put(bytes); header.rewind(); write(0, header); }
private void writeStoreHeader() { StringBuilder buff = new StringBuilder(); if (lastChunk != null) { storeHeader.put("block", lastChunk.block); storeHeader.put("chunk", lastChunk.id); storeHeader.put("version", lastChunk.version); } DataUtils.appendMap(buff, storeHeader); byte[] bytes = buff.toString().getBytes(DataUtils.LATIN); int checksum = DataUtils.getFletcher32(bytes, bytes.length); DataUtils.appendMap(buff, "fletcher", checksum); buff.append("\n"); bytes = buff.toString().getBytes(DataUtils.LATIN); ByteBuffer header = ByteBuffer.allocate(2 * BLOCK_SIZE); header.put(bytes); header.position(BLOCK_SIZE); header.put(bytes); header.rewind(); write(0, header); }
private void writeStoreHeader() { StringBuilder buff = new StringBuilder(); if (lastChunk != null) { storeHeader.put("block", lastChunk.block); storeHeader.put("chunk", lastChunk.id); storeHeader.put("version", lastChunk.version); } DataUtils.appendMap(buff, storeHeader); byte[] bytes = buff.toString().getBytes(DataUtils.LATIN); int checksum = DataUtils.getFletcher32(bytes, bytes.length); DataUtils.appendMap(buff, "fletcher", checksum); buff.append("\n"); bytes = buff.toString().getBytes(DataUtils.LATIN); ByteBuffer header = ByteBuffer.allocate(2 * BLOCK_SIZE); header.put(bytes); header.position(BLOCK_SIZE); header.put(bytes); header.rewind(); write(0, header); }