Mercurial > hg4j
comparison src/org/tmatesoft/hg/internal/Internals.java @ 667:fba85bc1dfb8
Refactoring: move all encoding/decoding operations into single place, EncodingHelper
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 11 Jul 2013 17:54:08 +0200 |
parents | 46b56864b483 |
children | b4242b7e7dfe |
comparison
equal
deleted
inserted
replaced
666:27a3ddedd6cc | 667:fba85bc1dfb8 |
---|---|
245 } | 245 } |
246 | 246 |
247 public boolean isCaseSensitiveFileSystem() { | 247 public boolean isCaseSensitiveFileSystem() { |
248 return isCaseSensitiveFileSystem; | 248 return isCaseSensitiveFileSystem; |
249 } | 249 } |
250 | 250 |
251 public EncodingHelper buildFileNameEncodingHelper() { | |
252 return new EncodingHelper(getFilenameEncoding(), repo.getSessionContext()); | |
253 } | |
254 | |
255 public boolean fncacheInUse() { | 251 public boolean fncacheInUse() { |
256 return (getRequiresFlags() & RequiresFile.FNCACHE) != 0; | 252 return (getRequiresFlags() & RequiresFile.FNCACHE) != 0; |
257 } | 253 } |
258 | 254 |
259 /*package-local*/ Charset getFilenameEncoding() { | 255 public EncodingHelper buildFileNameEncodingHelper() { |
260 return getFileEncoding(getSessionContext()); | 256 return new EncodingHelper(getFileEncoding(getSessionContext()), repo); |
261 } | 257 } |
262 | 258 |
259 public static EncodingHelper buildFileNameEncodingHelper(SessionContext.Source ctx) { | |
260 return new EncodingHelper(getFileEncoding(ctx.getSessionContext()), ctx); | |
261 } | |
263 /*package-local*/ static Charset getFileEncoding(SessionContext ctx) { | 262 /*package-local*/ static Charset getFileEncoding(SessionContext ctx) { |
264 Object altEncoding = ctx.getConfigurationProperty(CFG_PROPERTY_FS_FILENAME_ENCODING, null); | 263 Object altEncoding = ctx.getConfigurationProperty(CFG_PROPERTY_FS_FILENAME_ENCODING, null); |
265 Charset cs; | 264 Charset cs; |
266 if (altEncoding == null) { | 265 if (altEncoding == null) { |
267 cs = Charset.defaultCharset(); | 266 cs = Charset.defaultCharset(); |